UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.markLabel.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(5, 5)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.markLabel.bounds;
maskLayer.path = maskPath.CGPath;
self.markLabel.layer.mask = maskLayer;
设置导航条字体样式
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:20]}];
字体大小、颜色
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor],
NSForegroundColorAttributeName, nil];
[self.navigationController.navigationBar setTitleTextAttributes:attributes];
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { return (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight); }
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscapeRight;
}
汉字转拼音
NSMutableString *mutableString = [NSMutableString stringWithString:person.name];
CFStringTransform((CFMutableStringRef)mutableString, NULL, kCFStringTransformToLatin, false);
mutableString = (NSMutableString *)[mutableString stringByFoldingWithOptions:NSDiacriticInsensitiveSearch locale:[NSLocale currentLocale]];
pt 和 px 的转换
添加边框 切圆角
text.layer.cornerRadius = 5;
text.layer.masksToBounds = YES;
text.layer.borderWidth = 1;
text.layer.borderColor = [UIColor blueColor].CGColor;
text.borderStyle = UITextBorderStyleRoundedRect;
点击按钮高亮
_button.showsTouchWhenHighlighted = YES;
原文:http://www.cnblogs.com/OrangesChen/p/5041925.html