objective-c - 以编程方式更改 UISegmentedControl 标题

标签 objective-c xcode uisegmentedcontrol

如何以编程方式更改 UISegmentedControl 标题?你能帮帮我吗?

@synthesize filterControl; //UISegmentedControl

- (void)viewDidLoad
{
    [super viewDidLoad];

    filterControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"ALL",@"PROFIT",@"LOSS", nil]]; //not working

}

最佳答案

就用

-setTitle:(NSString*)title forSegmentAtIndex:(NSUInteger)index;

关于objective-c - 以编程方式更改 UISegmentedControl 标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10515614/

相关文章:

xcode - NSTextField 没有成员 'text'

iphone - 制作 iPhone 4S ***ONLY*** 应用程序

ios - 以下哪项将设置UISegmentedControl的字体?

iphone - UISegmentedControl 触摸时的色调颜色

iphone - 从后台线程访问 NSManagedObject

iphone - 从另一个类调用方法时为空变量

objective-c - 使用分段控件过滤 TableView 的部分

objective-c - MKMapView 居中并将 View 缩放到注释,

objective-c - 当我尝试构建这个简单的 XCode 项目时,为什么会收到 "parse error before ' @' token"?

iphone - 使用编辑按钮更改分段控件的标题?