I am sure it is just for someone. I have a UISegmentedControl that I use as a button (so as not to use the unpleasant default button), and I am having problems getting the target to work ... the code is as follows
- (void)viewDidLoad
{
[super viewDidLoad];
UISegmentedControl* read = [[[UISegmentedControl alloc] initWithFrame:CGRectMake(5, 50, 310, 54)] autorelease];
[read insertSegmentWithTitle:@"Read" atIndex:0 animated:NO];
read.tintColor = [UIColor colorWithRed:0.3 green:0.3 blue:0.9 alpha:1];
read.segmentedControlStyle = UISegmentedControlStyleBar;
[read addTarget:self action:@selector(changeFilter:sender:) forControlEvents:UIControlEventTouchUpInside];
[read setTag:1];
[self.view addSubview:read];
}
and then
-(void)changeFilter:(id)sender{
}
for any reason, clicking on the UISegmentedControl does not start the target method.
As an add-on, is there an easier way to make pretty UIButtons? I do not have access to Photoshop at work (although I have gimp installed), so a method that does not include creating images will be good. I can’t believe that the apple did not provide attractive UIButtons in the user interface, it seems that this is very important?
Anyway, thanks for the help of mis amigos.
... ,
[read addTarget:self action:@selector(changeFilter:) forControlEvents:UIControlEventTouchUpInside];
@interface
-(void)changeFilter:(id)sender;
@implementation
-(void)changeFilter:(id)sender{}
, , UISegmentedControl. , API Glass, , , , !