iOS-基本知识汇总

来源:互联网 发布:软件协会会员牌匾 编辑:程序博客网 时间:2024/06/10 03:10
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   yeslayer.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
原创粉丝点击