sunshine隨筆

1.修改textfield的顏色及位置

可以繼承textfield類

重寫它的方法;

-(void)drawPlaceholderInRect:(CGRect)rect

{

[[UIColor purpleColor]setFill];

[self.placeholder drawInRect:rect withFont:self.font lineBreakMode:UILineBreakModeTailTruncation alignment:self.textAlignment];

}

2.設(shè)置導(dǎo)航條透明?

[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];

self.navigationController.navigationBar.shadowImage = [UIImage new];

self.navigationController.navigationBar.translucent = YES;

3.當(dāng)自定義導(dǎo)航條左側(cè)的item ?iOS 自帶的側(cè)滑就會(huì)消失 可以這樣來實(shí)現(xiàn)側(cè)滑

self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:nil style:UIBarButtonItemStylePlain target:self action:@selector(act)];? ? self.navigationController.interactivePopGestureRecognizer.delegate = (id<UIGestureRecognizerDelegate>)self;

4.監(jiān)控鍵盤的事件;IQKeyboardManager ?三方庫

滑動(dòng),點(diǎn)擊 隱藏導(dǎo)航欄(iOS8之后)

self.navigationController.hidesBarsOnSwipe = YES;

self.navigationController.hidesBarsOnTap = YES;

5.xib中設(shè)置邊框

@interface CALayer (XibConfiguration)

// layer.cornerRadius

// layer.borderWidth

// layer.borderUIColor? 邊框顏色屬性用borderUIColor

@property(nonatomic, assign) UIColor *borderUIColor;

-(void)setBorderUIColor:(UIColor*)color

{self.borderColor = color.CGColor;}

-(UIColor*)borderUIColor

{return [UIColor colorWithCGColor:self.borderColor];}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容