iBokan_ios80_第一个2货UI

来源:互联网 发布:同步软件 编辑:程序博客网 时间:2024/05/18 08:59
<strong><span style="font-size:18px;">////  ViewController.m//  小婊砸////  Created by Ibokan_Ze on 15/7/6.//  Copyright (c) 2015年 Ibokan. All rights reserved.//#import "ViewController.h"@interface ViewController ()@property(strong,nonatomic)UILabel *labelA;@property(strong,nonatomic)UIButton *button;@property(strong,nonatomic)UILabel *labelB;@end@implementation ViewController- (void)viewDidLoad {        UIScreen *s = [UIScreen mainScreen];    CGRect frame = s.bounds;    NSLog(@"高度是:%g\n宽度是:%g",frame.size.height,frame.size.width);    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"BGA.png"]];        [super viewDidLoad];    self.labelB = [[UILabel alloc] initWithFrame:CGRectMake(7.5, 100, 360, 50)];    self.labelB.textColor = [UIColor grayColor];    self.labelB.text = @"第一个UI界面";    self.labelB.textAlignment = NSTextAlignmentCenter;    [self.view addSubview:self.labelB];        self.labelA = [[UILabel alloc] initWithFrame:CGRectMake(7.5, 150, 360, 50)];    self.labelA.textColor = [UIColor whiteColor];    self.labelA.textAlignment = NSTextAlignmentCenter;//对齐方式    self.labelA.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Label.png"]];    self.labelA.text = @"基础控件标签!";    [self.view addSubview:self.labelA];                self.button = [[UIButton alloc] initWithFrame:CGRectMake(7.5, 260, 360, 150)];    self.button.backgroundColor = [UIColor redColor];    [self.button setTitle:@"你TMD敢不敢点我" forState:UIControlStateNormal];    [self.button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];    [self.button addTarget:self action:@selector(tapButton:) forControlEvents:UIControlEventTouchUpInside];    [self.button setBackgroundImage:[UIImage imageNamed:@"IMG.png"] forState:UIControlStateNormal];            [self.view addSubview:self.button];    }- (void)tapButton:(UIButton *)btn{    static int count = 0;    count++;    NSString *str = [NSString stringWithFormat:@"你居然点我%d下了!",count];    self.labelA.text = str;    [self.button setTitle:str forState:UIControlStateNormal];    if (count <= 10) {        self.labelA.text = @"~~轻点~~";    }else if (count <= 20 && count > 10)    {        self.labelA.text = @"你怎么还在点我......";    }else if (count <= 50 && count > 20)    {        self.labelA.text = @"吃饭了,你妈妈叫你回家吃饭了!";        self.labelB.text = @"你妈妈:我可没叫他吃饭!";    }else if(count > 50)    {        self.labelA.text = @"你太无聊了哦~~";    }    }- (void)didReceiveMemoryWarning {    [super didReceiveMemoryWarning];    // Dispose of any resources that can be recreated.}@end</span></strong>

0 0
原创粉丝点击