iOS学习笔记-091.彩票06——我的彩票

来源:互联网 发布:calibre安卓软件 编辑:程序博客网 时间:2024/05/17 01:02

  • 彩票06我的彩票
    • 一图示
    • 二xib创建说明
    • 三QWMMyLotteryViewControllerm 说明

彩票06——我的彩票

一、图示

这里写图片描述


二、xib创建说明

我们的界面可是使用 xib 来创建,创建一个名字为 QWMMyLotteryViewController.xib 文件。

设置 file Owner 文件拥有者是 QWMMyLotteryViewController

这里写图片描述


三、QWMMyLotteryViewController.m 说明

我们创建的 UIButton 图片的背景要处理,不然不是我们要的效果。这里面需要拉伸图片。

iOS图片拉伸技巧

////  QWMMyLotteryViewController.m//  03_UIView79_彩票////  Created by 杞文明 on 17/7/24.//  Copyright © 2017年 杞文明. All rights reserved.//#import "QWMMyLotteryViewController.h"@interface QWMMyLotteryViewController ()@property (weak, nonatomic) IBOutlet UIButton *loginBtn;@end@implementation QWMMyLotteryViewController- (void)viewDidLoad {    [super viewDidLoad];    //1.设置登陆按钮的背景图片    //1.1拿到背景图片    UIImage *image = self.loginBtn.currentBackgroundImage;    //1.2拉伸图片    image = [image stretchableImageWithLeftCapWidth:image.size.width/2 topCapHeight:image.size.height/2];    //1.3设置背景图片    [self.loginBtn setBackgroundImage:image forState:UIControlStateNormal];    //2.设置导航左侧按钮    UIButton *leftBtn = [[UIButton alloc]init];    [leftBtn setImage:[UIImage imageNamed:@"FBMM_Barbutton"] forState:UIControlStateNormal];    [leftBtn setTitle:@"客服" forState:UIControlStateNormal];    [leftBtn sizeToFit];    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:leftBtn];    //3.设置导航右侧    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageWithRenderOriginalName:@"Mylottery_config"] style:UIBarButtonItemStylePlain target:self action:@selector(setting)];}-(void)setting{    NSLog(@"settting------");}@end
原创粉丝点击