I have segment control and code like this in .m file
-(IBAction)sectionswitch:(id)sender {
if (control.selectedSegmentIndex == 0) {
UIImage *dekabristov = [UIImage imageNamed:@"dekabristov.png"];
[image setImage:dekabristov];
}
if (control.selectedSegmentIndex == 1) {
UIImage *fabrika = [UIImage imageNamed:@"fabrika.jpg"];
[image setImage:fabrika];
}
}
How i can change title of action button inside segment control? If i write [button setTitle:@"Button!"];
Xcode says "Use undeclared identifier "button", but -(IBAction)button:(id)sender;
in .h file
in that way, you have not declared a button, but only an action called 'button'.
in your .h file you should do:
and for change title of segment control you can do:
if you want change a title of an UIButton: