关闭

iBokan_ios80_第一个2货UI

104人阅读 评论(0) 收藏 举报
<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

猜你在找
【直播】机器学习&数据挖掘7周实训--韦玮
【套餐】系统集成项目管理工程师顺利通关--徐朋
【直播】3小时掌握Docker最佳实战-徐西宁
【套餐】机器学习系列套餐(算法+实战)--唐宇迪
【直播】计算机视觉原理及实战--屈教授
【套餐】微信订阅号+服务号Java版 v2.0--翟东平
【直播】机器学习之矩阵--黄博士
【套餐】微信订阅号+服务号Java版 v2.0--翟东平
【直播】机器学习之凸优化--马博士
【套餐】Javascript 设计模式实战--曾亮
查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1551次
    • 积分:130
    • 等级:
    • 排名:千里之外
    • 原创:11篇
    • 转载:0篇
    • 译文:0篇
    • 评论:0条
    文章存档