iOS遇到的细节问题

1.为UILable添加点击手势

    

    UILabel *text01 = [[UILabel alloc]initWithFrame:CGRectMake(0, mView.height/5+1, mView.width, mView.height/5)];

    text01.text = @"还没有账号?点击注册吧!";

    text01.textColor = [kTabBarColor];

    text01.textAlignment = NSTextAlignmentCenter;

    text01.font = [UIFont systemFontOfSize:14];

   text01.userInteractionEnabled = YES;//重要,很容易被遗忘的一句话

    UITapGestureRecognizer *tapToRegister = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(toRegister:)];

    tapToRegister.numberOfTouchesRequired = 1;//只处理一个手指的触碰事件

    [text01 addGestureRecognizer:tapToRegister];

    [mView addSubview:text01];



#pragma mark -点击,跳转到注册页面

-(void)toRegister:(UITapGestureRecognizer *)gesture{

    NSLog(@"go to register...");

}



2.如何制作圆形图片UIImageView,并添加白色边框

    UIImageView *mHeadImg = [[UIImageView alloc]initWithFrame:CGRectMake(kScreen_width/2-35, kScreen_height/5-10, 70, 70)];

    mHeadImg.image = [UIImage imageNamed:@"圆形人物上传头像"];

    mHeadImg.layer.borderColor = [[UIColor whiteColor] CGColor];

    mHeadImg.layer.borderWidth = 2.0f;

    mHeadImg.layer.cornerRadius = 35;

    [self.view addSubview:mHeadImg];

效果图:




3.如何实现这种效果:



代码如下:

self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.0f/255.0 green:194.0f/255.0 blue:194.0f/255.0 alpha:1.0];

[self.navigationController.navigationBar setTitleTextAttributes:

     @{NSFontAttributeName:[UIFont systemFontOfSize:18],

       NSForegroundColorAttributeName:[UIColor whiteColor]}];

self.navigationItem.title = @"设置";

self.view.backgroundColor = [UIColor colorWithRed:235/255.0 green:236/255.0 blue:237/255.0 alpha:1];


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值