1.集成支付宝SDK时错误的解决办法
http://blog.csdn.net/l648320605/article/details/38919861
2.关于tableview cell中nan错误时的解决方法
这种错误是在float经过函数运行出了不是数字的值,nan的意思就是not a number。
主要常见原因:
(1).除以0
(2).sizeWithFont的字符串为nil
(3).数学函数不正确运算
Xcode设置断点快捷调试方法:
http://www.cocoachina.com/bbs/read.php?tid=136006
3.pop出栈,控制器回退出错
错误写法:
1 MainViewController *mainVC = [MainViewController new];
2 [self.navigationController popToViewController:mainVC animated:YES];
三种方法:
1 //(1)
2 [self.navigationController popViewControllerAnimated:YES]; 2 //(2) 3 [self.navigationController popToRootViewControllerAnimated:YES]; 4 //(3) 5 self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];
解决方法:区别于错误写法和第三种方法,另外虽然第三种方法写法正确,但是由于下标的难以计数和变动性,所以不推荐
第三种方法可有几种写法;其中包括直接下标(静态,不推荐),forin查找以及借用单例记录下标再次跳转等等.
1 [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:2] animated:YES];
2 或
3 for (UIViewController *controller in self.navigationController.viewControllers) {
4 if ([controller isKindOfClass:[你要跳转到的Controller class]]) {
5 [self.navigationControllerpopToViewController:controller animated:YES];
6 }
7 }
8 或者
9 [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex: ([self.navigationController.viewControllers count] -6)] animated:NO];
经典帖子地址:http://blog.163.com/wzi_xiang/blog/static/65982961201211193275578/
4.关于UIButton的细节体验效过点击时没有触感
解决方法:设定UIButton的被点击的类型
修正关键代码:
1 UIButton * aboutUsBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
系统给定的方法:
1 UIButtonTypeCustom = 0, // no button type
2 UIButtonTypeSystem NS_ENUM_AVAILABLE_IOS(7_0), // standard system button
3
4 UIButtonTypeDetailDisclosure,
5 UIButtonTypeInfoLight,
6 UIButtonTypeInfoDark,
7 UIButtonTypeContactAdd,
8
9 UIButtonTypeRoundedRect = UIButtonTypeSystem,
UIButtonTypeCustom为自定义类型,不添加点击状态时默认不改变
UIButtonTypeRoundedRect一般给定一个点击的高亮效果或暗淡(这是正需要的)
http://blog.csdn.net/cheneystudy/article/details/8115092
5.UIButton标题换行.要求效果如下
起先考虑到UILabel,但是后面发现用Label覆盖了Button之后就没了触感效果(详情见当前错点第4条)
解决关键代码:
(1)aboutUsBtn.titleLabel.numberOfLines = 0;
(2)[NSString stringWithFormat:@"%@
%@",@"About Us",@"关于我们"]
1 UIButton * aboutUsBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
2 aboutUsBtn.frame = CGRectMake(menuWidth * 2/3 + controlGap, 0.0, menuWidth * 1/3 - controlGap, menuHeight);
3 aboutUsBtn.backgroundColor = diningBtnColor;
4 aboutUsBtn.titleLabel.numberOfLines = 0;
5 [aboutUsBtn setTitle:[NSString stringWithFormat:@"%@
%@",@"About Us",@"关于我们"] forState:UIControlStateNormal];
6 [aboutUsBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
7 [aboutUsBtn addTarget:self action:@selector(aboutUsBtnClick) forControlEvents:UIControlEventTouchUpInside];
8 [menuView addSubview:aboutUsBtn];
6.由pushViewController说起可能出现的各种死法
http://qzc770707.blog.163.com/blog/static/3408275320115288241822/
7.百度地图导包编译失败
#方法2是用cd进入SDK包 终端输入lipo -create 然后把两个.a文件拖入后面 接后续命令生成新的.a文件
红字部分具体该怎么填写?
如果项目中内容如下:
则有
$(SRCROOT)/QCHJ_iPhone/BaiduMap_IOSSDK_v2.6.0_Lib/Release$(EFFECTIVE_PLATFORM_NAME)
这样做就避免了在模拟器和真机之间反复测试时的,删除重导的麻烦
8.怎么删除写入NSUserDefaults里的内容
[[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
[[NSUserDefaults standardUserDefaults] synchronize];
http://blog.csdn.net/crycheng/article/details/22285917
9.关于cocoaPods使用过程中 Podfile配置文件的格式
platform :ios,'7.0'
pod "AFNetworking", "~>2.0"
10.iOS 获得版本号 区分BundleVersion和BundleShortVersionString