iOS-基本知识汇总

1.隐藏按钮
sender.hidden = YES;
2.按钮常用基础知识
//获取按钮指定状态下的文字
NSString *text = [sender titleForState:UIControlStateNormal];
//获取当前状态下的文字
NSString *text = sender.currentTitle;
//按钮是否可用
 sendBtn.enabled = YES/NO;
3.控制view层上的按钮控件是否可以点击
self.optionsView.userInteractionEnabled = YES/NO;
4.UIAlertView用法
//弹出一个对话框
UIAlertView * msgView = [[UIAlertView alloc] initWithTitle:@"操作提示" message:@"恭喜您过关啦"delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", @"哈哈",nil];
//显示对话框
[msgView show];
//监控UIAlertView某个按钮需要代理UIAlertViewDelegate,
//实现UIAlertView的代理方法
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    NSLog(@"%ld",buttonIndex);
}
5.UITableView,一般当数据少于屏幕的高度时候,下方会有多余的tableViewCell.解决办法:
self.tableView.tableFooterView = [[UIView alloc] init];
6.图片变成圆形,需要设置其属性key path:
layer.masksToBounds  Boolean   yes
layer.cornerRadius       Number   25(图片尺寸的1/2)
iOS-基本知识汇总 - lightingbolt - lightingbolt的博客
7.textField赋值
[self.contactText setText:@""];
7.UIView展示的几种形式,推出(push),模态(由底部向上弹出)
   a).push:
     XNewsReviewViewController* reviewVc = [[XNewsReviewViewController alloc] init];
   [self.navigationController pushViewController:reviewVc animated:YES];
   b).模态
     XNewsSettingViewController * settingVc=[[XNewsSettingViewController alloc] init];
    XNewsNavigationController *nav = [[XNewsNavigationController alloc] initWithRootViewController:settingVc];
    [self presentViewController:nav animated:YES completion:^{
        
    }];
9.tableViewCell相关
   a).系统默认箭头
  cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; //显示最右边的箭头
    b).选中tableViewCell时候去掉选中效果
   cell.selectionStyle = UITableViewCellSelectionStyleNone;
lightingBolt
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值