随手记一下,省得以后老需要百度,想到哪里记到哪里吧.
视图切换
//直接返回根视图
[[self navigationController] popToRootViewControllerAnimated:YES];
//返回上级页面
[self.navigationController popViewControllerAnimated:YES];
//切换根视图
self.navigationController.tabBarController.hidesBottomBarWhenPushed=NO;
self.navigationController.tabBarController.selectedIndex=1;
//根据数量返回页面
if (self.navigationController.viewControllers.count >=2) {
UIViewController *listViewController =self.navigationController.viewControllers[1];
[self.navigationController popToViewController:listViewController animated:YES];
}
UIButton
//设置按钮圆角
self.but.layer.cornerRadius = 15;
//设置边框
[self.but.layer setBorderWidth:1.0];
self.but.layer.borderColor=[UIColor blackColor].CGColor;
//点击事件
[self.but addTarget:self action:@selector(login) forControlEvents:UIControlEventTouchUpInside];
UIView
//绑定事件
UITapGestureRecognizer* bankcardmethod = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bankcardsgo)];
[self.bankcardview addGestureRecognizer:bankcardmethod];
self.bankcardview.userInteractionEnabled = YES;
UITextField
//键盘为数字
self.pass.keyboardType = UIKeyboardTypeNumberPad;
//输入文字右侧对齐
self.pass.textAlignment = NSTextAlignmentRight;
//输入框只读
self.pass.enabled=NO;
//修改TextField中的placeholder字体大小和颜色
NSString *passText = @"请输入验证码";
NSMutableAttributedString *passplaceholder = [[NSMutableAttributedString alloc] initWithString:passText];
[passplaceholder addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHexString:@"#808080"] range:NSMakeRange(0, passText.length)];
[passplaceholder addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:16] range:NSMakeRange(0, passText.length)];self.pass.attributedPlaceholder = passplaceholder;
UITableView
//设置头视图
self.tableView.tableHeaderView = self.addstoreview;
//设置脚视图
self.tableView.tableFooterView = self.addstoreview;