摘要:
1 UIView *view = [[UIView alloc] init];2 view.hidden = YES; // 隐藏3 [view setBackgroundColor:[UIColor colorWithRed:1.0 green:0.5 blue:0.5 alpha:1.0]]; // 设置背景颜色,此处的alpha只是让背景透明4 view.alpha = 0.6; // 设置透明效果,背景和文字都透明5 view.contentMode = UIViewContentModeBottom; // 设置与父视图位置关系6 view.c... 阅读全文
摘要:
1 UISegmentedControl *seg = [[UISegmentedControl alloc] 2 initWithItems:[NSArray arrayWithObjects:@"one",@"two",@"three", nil]]; 3 seg.segmentedControlStyle = UISegmentedControlStylePlain; // 设置分段按钮类型 4 seg.segmentedControlStyle = UISegmentedControlStyleBar; 5... 阅读全文
摘要:
1 UISwitch *sw = [[UISwitch alloc] initWithFrame:CGRectMake(0, 0, 100, 50)];2 sw.on = YES; // 开启3 [sw addTarget:self4 action:@selector(mySwitch:)5 forControlEvents:UIControlEventValueChanged]; // 值改变时触发此事件 阅读全文
摘要:
1 UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(20, 20, 280, 30)]; 2 tf.borderStyle = UITextBorderStyleNone; // 无边框线 3 // UITextBorderStyleBezel(边框+阴影) ,UITextBorderStyleLine(边框线) ,UITextBorderStyleRoundedRect(圆角+阴影) 按钮样式 4 tf.text = @"xxxxx"; // 内容 5 ... 阅读全文
摘要:
1 UIButton *bt = [UIButton buttonWithType:UIButtonTypeContactAdd];// UIButtonTypeCustom, UIButtonTypeRoundedRect; // 2 [bt setTitle:@"myButton" forState:UIControlStateNormal]; // 普通状态 3 [bt setTitle:@"Button1" forState:UIControlStateHighlighted]; // 触摸时 4 [bt setTitle:@"disB 阅读全文
摘要:
UILabel *label = [[UILabel alloc] init]; label.frame = self.view.bounds; // 设置大小 label.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth | UIViewAnimationTransitionNone | UIViewAutoresizingFlexibleHeight | UIViewAnimationTransitionFlipFromLe... 阅读全文