修改類名
選中類里面的類名允睹,選edit-refactor-rename赘淮。
獲取系統(tǒng)自帶背景色
self.tableView.backgroundColor = [UIColor groupTableViewBackgroundColor];
pikcerView設(shè)置
//設(shè)置默認顯示哪行
[self.pickerGender selectRow:0 inComponent:0 animated:YES];
邊框設(shè)置(圓角、顏色)
UIButton *signBtn = [UIButton buttonWithType:UIButtonTypeCustom];
signBtn.frame = CGRectMake(0, 0, 80, 40);
[signBtn.layer setMasksToBounds:YES];
[signBtn.layer setCornerRadius:10.0]; //設(shè)置矩形四個圓角半徑
[signBtn.layer setBorderWidth:1.0]; //邊框?qū)挾?/p>
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGColorRef colorref = CGColorCreate(colorSpace,(CGFloat[]){ 1, 0, 0, 1 });
[signBtn.layer setBorderColor:colorref];//邊框顏色
輸入框輸入完成鍵盤類型設(shè)置(返回按鈕):
UITextField *detailField = [[UITextField alloc] initWithFrame:CGRectMake(10, 0, screenWith-20, 60)] ;
//設(shè)置鍵盤返回按鈕設(shè)置(默認換行)
detailField.returnKeyType = UIReturnKeyDone;
UITextView *textViewEdit= [[UITextView alloc] initWithFrame:CGRectMake(10, 0, screenWith-20, 80)];
textViewEdit.returnKeyType=UIReturnKeyDone;
圖片填充樣式:
//設(shè)置按鈕內(nèi)圖片樣式居中(原尺寸顯示)
self.imageView.contentMode =UIViewContentModeCenter;
按鈕內(nèi)圖片默認拉伸方式填充。
一般選擇UIViewContentModeScaleAspectFill。
刪除一行cell:
[self.list removeObjectAtIndex:row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationAutomatic];
移除在dealloc里進行。
//去除tableView頂部下拉彈簧效果(禁止tableView反彈)
_myTableView.bounces = NO;
更改手機狀態(tài)欄樣式
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
淺間隔線:
UIColorFromRGBA(220, 220, 220, 0.8)
獲取一個view內(nèi)部控件最好的辦法蜗细!不是遍歷,是設(shè)置tag怒详!
//為cell添加左邊藍條炉媒,只在點擊時顯示
UIView *blueView = [[UIView alloc]initWithFrame:CGRectMake(0, 0,4,44)];
blueView.backgroundColor = kMainColorOfApp;
blueView.tag = 111;
[cell addSubview:blueView];
//顯示藍條
UIView *blueView = [cell viewWithTag:111];
blueView.hidden = NO;
字符串函數(shù)大全:
http://www.cnblogs.com/heyonggang/p/3452556.html
函數(shù)名: floor
功 能: 返回比參數(shù)小的最大整數(shù)
設(shè)置tableview的group樣式:要在alloc時設(shè)置
CashCouponDetailIntroduceViewController *introduceVC = [[CashCouponDetailIntroduceViewController alloc]initWithStyle:UITableViewStyleGrouped];
self.detailIntroVC = introduceVC;
//如果URL中沒有檢測到有http,則給它加上
NSRange range = [self.url rangeOfString:@"Http" options:NSCaseInsensitiveSearch];
if (range.location == NSNotFound) {
self.url = [@"http://" stringByAppendingString:self.url];
}