ios 纯代码加载UIButton

 

UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
        backButton.frame = CGRectMake(16, 40, 45, 45);
        [backButton addTarget:self action:@selector(splashBack:) forControlEvents:UIControlEventTouchUpInside];
        [backButton setBackgroundImage:[UIImage imageNamed:@"返回"] forState:UIControlStateNormal];
        
        [self.view addSubview:backButton];

 

posted on 2016-07-14 16:24  codemaker313  阅读(210)  评论(0编辑  收藏  举报

导航