iOS开发问题纪录
1.UIStatusBar 颜色变白
dddplist里设置两项
1.Status bar style = UIStatusBarStyleLightContent
2. View controller-based status bar appearance = NO
怎么改变状态栏的颜色
2.iOS7 UITabBar自定义选中图片显示为默认蓝色的Bug
UIImage* image =[UIImageimageNamed:@"tab-tip2"];
image = [imageimageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.tabBarItem.selectedImage= image;
另外一种设置[背景色,图片色,文字色]
3.如何判断一个类是否支持某属性和方法以及如何判断IOS的版本
instancesRespondToSelector
respondsToSelector
4.storyboard里的viewcontroller里view上拖进去的控件运行起来看不到
storyboard在设置为 wCompact 和hCompact时对控件的显示需要在 属性面板中的installed勾选上
5.attributedString属性
NSDictionary*underlineAttribute=@{NSUnderlineStyleAttributeName:@(NSUnderlineStyleSingle)};
myLabel.attributedText=[[NSAttributedStringalloc]initWithString:@"Test string"attributes:underlineAttribute];
6.自定义导航条按钮并系统返回手姿 以及 导航条按钮颜色 设置
7.tableviewcell 分割线
viewDidLoad方法和willDisplayCell中加上如下代码:
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsZero];
}
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView setLayoutMargins:UIEdgeInsetsZero];
}
if([cellrespondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
[cellsetPreservesSuperviewLayoutMargins:NO];
}
1. 改变标签栏横线颜色
NSArray *tabArray=self.tabBarController.tabBar.subviews;
for ( id obj in tabArray) {
if ([obj isKindOfClass:[UIImageView class]]) {
UIImageView *imageView=(UIImageView *) obj;
imageView.backgroundColor=View_ToolBar;
}
2.改变导航条横线颜色
//给imgaeview 添加一个类别
+ (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size
{
CGRect rect = CGRectMake(0, 0, size.width, size.height);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context,
color.CGColor);
CGContextFillRect(context, rect);
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
//调用
[[UINavigationBar appearance] setShadowImage:[UIImage imageWithColor:tabBar_line size:CGSizeMake(kDeviceWidth, 1)]];
iOS 关于1900时间字符串转Date类型的问题记录
UIAlertView 键盘问题
uialertview 弹出是有键盘处理,需要在uialertview之前处理键盘问题,不然确定后会闪跳键盘