美文网首页
sunshine随笔

sunshine随笔

作者: sunghui | 来源:发表于2016-01-25 17:25 被阅读25次

1.修改textfield的颜色及位置

可以继承textfield类

重写它的方法;

-(void)drawPlaceholderInRect:(CGRect)rect

{

[[UIColor purpleColor]setFill];

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

}

2.设置导航条透明 

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

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

self.navigationController.navigationBar.translucent = YES;

3.当自定义导航条左侧的item  iOS 自带的侧滑就会消失 可以这样来实现侧滑

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

4.监控键盘的事件;IQKeyboardManager  三方库

滑动,点击 隐藏导航栏(iOS8之后)

self.navigationController.hidesBarsOnSwipe = YES;

self.navigationController.hidesBarsOnTap = YES;

5.xib中设置边框

@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];}

相关文章

网友评论

      本文标题:sunshine随笔

      本文链接:https://www.haomeiwen.com/subject/mtqdkttx.html