117
edits
No edit summary |
m (→PickerView.h) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
* a backgroundView for the whole picker | * a backgroundView for the whole picker | ||
* a backgroundView for every picker item | * a backgroundView for every picker item | ||
* | * an image for the selected item in the picker item | ||
* an overlay image for the picker item, you can use this, to darken the top most and bottom most elements | * an overlay image for the picker item, you can use this, to darken the top most and bottom most elements | ||
[[UIImage]] (Some hints for the images) | |||
=== Required objects === | === Required objects === | ||
Line 60: | Line 61: | ||
/* Method sets the background views for the pickers | /* Method sets the background views for the pickers | ||
bgViews an array of background views for the pickers | bgViews an array of background views for the pickers | ||
YOU should have for every Picker one background view | |||
*/ | |||
-(void) setBackgroundViews: (NSArray*) bgViews; | |||
/* Method sets the selected background views for the pickers | |||
bgViews an array of selected background views for the pickers | |||
YOU should have for every Picker one background view | YOU should have for every Picker one background view | ||
Line 107: | Line 116: | ||
@end | @end | ||
</source> | </source> | ||
=== PickerView.m === | === PickerView.m === | ||
<source lang="objc"> | <source lang="objc"> | ||
Line 151: | Line 161: | ||
/* Method sets the background views for the pickers | /* Method sets the background views for the pickers | ||
bgViews an array of background views for the pickers | |||
YOU should have for every Picker one background view | |||
*/ | |||
-(void) setBackgroundViews: (NSArray*) bgViews{ | |||
//If bgViews count is not equal to the picker view count | |||
if ([bgViews count] !=[self.titleArray count]) { | |||
return; | |||
} | |||
for (int i=0; i<[self.titleArray count]; i++) { | |||
UIView* newView=[bgViews objectAtIndex:i]; | |||
if (!newView) { | |||
return; | |||
} | |||
int index=10004+i*10; | |||
UIView* v=[self.baseView viewWithTag:index]; | |||
newView.frame=v.frame; | |||
[v.superview insertSubview:newView belowSubview:v]; | |||
[v removeFromSuperview]; | |||
} | |||
} | |||
/* Method sets the selected background views for the pickers | |||
bgViews an array of background views for the pickers | bgViews an array of selected background views for the pickers | ||
YOU should have for every Picker one background view | YOU should have for every Picker one selected background view | ||
*/ | */ | ||
-(void) setSelectedBackgroundViews: (NSArray*) bgViews{ | -(void) setSelectedBackgroundViews: (NSArray*) bgViews{ | ||
Line 499: | Line 533: | ||
</source> | </source> | ||
[[Category:IOS | [[Category:IOS]] | ||
[[Category:Cocoa]] | |||
[[Category:IPad]] | |||
[[Category:IPhone]] | |||
[[Category:IPodTouch]] | |||
[[Category:Mobile Development]] | |||
[[Category:Objective-C]] | |||
[[Category:Programmiersprachen]] |
edits