I have a segmented control in the navigation bar. Just like in the docs
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:
[NSArray arrayWithObjects:
[UIIma开发者_JS百科ge imageNamed:@"up.png"],
[UIImage imageNamed:@"down.png"],
nil]];
[segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];
segmentedControl.frame = CGRectMake(0, 0, 90, kCustomButtonHeight);
But I get kCustomButtonHeight undeclared. Has this been deprecated? What am I missing here?
kCustomButtonHeight
is a macro the person who wrote that example code made up. It's nothing included in UIKit
or anything. You can define it yourself, if you want, and make it anything you'd like.
#define kCustomButtonHeight 42
This was never part of the SDK, from what I can see through Google, it seems that kCustomButtonHeight is just defined in some Apple sample code that you may have used.
精彩评论