UISegmentedControl
来源:互联网 发布:贪心算法的优缺点 编辑:程序博客网 时间:2024/05/16 12:45
#import "ViewController.h"@interface ViewController (){ UISegmentedControl *sc;}@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. sc = [[UISegmentedControl alloc] initWithItems:@[@"11123123123",@"22",@"33",@"44"]]; sc.frame = CGRectMake(10,20,300,30); [self.view addSubview:sc]; //短暂的 //sc.momentary = YES; sc.apportionsSegmentWidthsByContent = YES; //NSLog(@"%d",sc.numberOfSegments); //[sc setContentOffset:CGSizeMake(10,10) forSegmentAtIndex:1]; [sc setEnabled:NO forSegmentAtIndex:1]; sc.selectedSegmentIndex = 1; //字体边框颜色包括背景颜色 sc.tintColor = [UIColor redColor]; [sc setDividerImage:[UIImage imageNamed:@"22.jpg"] forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault];}- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { //[sc insertSegmentWithTitle:@"插入的按钮" atIndex:1 animated:YES]; //[sc insertSegmentWithImage:[[UIImage imageNamed:@"11.jpg"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]atIndex:0 animated:YES]; //[sc removeSegmentAtIndex:0 animated:YES]; //[sc removeAllSegments]; //[sc setTitle:@"i'm retitle" forSegmentAtIndex:1]; [sc setWidth:100 forSegmentAtIndex:1];}- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}@end
0 0
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- UISegmentedControl
- 【UISegmentedControl】
- 224.227. Basic Calculator I II
- 前端开发之日期控件、HTML5日期输入类型(date)
- 我叫感受
- 常见的PHP安全漏洞-跨站、注入和文件包含
- 新篇章之JavaScript
- UISegmentedControl
- OpenCV中的HOG+SVM物体分类
- 网络流
- STL算法概述
- 数据流中的中位数
- Java Thread.join()详解
- C++中的重载,重写, 重定义 差别
- union和union all的区别
- 【VS开发】【图像处理】Pleora推出iPORT CL-U3外置抓帧器