很多app都是设计为tabItem是两个状态,当前选择状态和未选择状态
ios7之前是这样的:
7.0之后storyboard里面可以这样:
ios7之前是这样的:
UITabBarItem* item = [self.tabBar.items objectAtIndex:1];
[item setFinishedSelectedImage:[UIImage imageNamed:@"1.png"]
withFinishedUnselectedImage:[UIImage imageNamed:@"2.png"]];
[item setFinishedSelectedImage:[UIImage imageNamed:@"1.png"]
withFinishedUnselectedImage:[UIImage imageNamed:@"2.png"]];
7.0之后storyboard里面可以这样:
id result = [self.tabBarItem initWithTitle:@"相片" image:[UIImage imageNamed:@"photo"] selectedImage:[UIImage imageNamed:@"photo_cur"]];
if (!result) {/*do sth*/}
if (!result) {/*do sth*/}
试过也一般,但官方是这样写的,备忘一下:
When URLs are just not resolving the way you want it, to time to clear or flush the dns nameserver local cache -flush-the-loacl-cache
How to clear the local DNS cache….
OSX 10.10
OSX 10.9
OSX 10.7 – 10.8
OSX 10.5 – 10.6
Windows
Linux (depending on what you’re running)
When URLs are just not resolving the way you want it, to time to clear or flush the dns nameserver local cache -flush-the-loacl-cache
How to clear the local DNS cache….
OSX 10.10
sudo discoveryutil udnsflushcaches
OSX 10.9
dscacheutil -flushcache; sudo killall -HUP mDNSResponder
OSX 10.7 – 10.8
sudo killall -HUP mDNSResponder
OSX 10.5 – 10.6
sudo dscacheutil -flushcache
Windows
ipconfig /flushdns
Linux (depending on what you’re running)
/etc/init.d/named restart
/etc/init.d/nscd restart
/etc/init.d/nscd restart
最近审核app,苹果拒绝了,说点击发邮件会闪退
自己测试了,没有问题,后来在另外的设备再次测试,真的是闪退
发现如果系统没有配置邮件,就会出现这样的问题
使用MFMailComposeViewController的时候,要判断一下是否可以发哦
自己测试了,没有问题,后来在另外的设备再次测试,真的是闪退
发现如果系统没有配置邮件,就会出现这样的问题
使用MFMailComposeViewController的时候,要判断一下是否可以发哦
if (![MFMailComposeViewController canSendMail]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"请配置邮件"
message:@"你的设备不支持发邮件,需要你配置你的设备"
delegate:self
cancelButtonTitle:@"好"
otherButtonTitles:nil,nil];
[alert show];
return;
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"请配置邮件"
message:@"你的设备不支持发邮件,需要你配置你的设备"
delegate:self
cancelButtonTitle:@"好"
otherButtonTitles:nil,nil];
[alert show];
return;
}
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.headIndent = 15; // <--- indention if you need it
paragraphStyle.firstLineHeadIndent = 15; //首行缩进
paragraphStyle.lineSpacing = 7; // <--- magic line spacing here! 行间距
UIFont *font = xxx //
NSDictionary *attrsDictionary =
@{ NSFontAttributeName: font, //<-- if you need; & there are many more attrs
NSParagraphStyleAttributeName: paragraphStyle};
self.textView.attributedText = [[NSAttributedString alloc]
initWithString:@"Hello World over many lines!" attributes:attrsDictionary];
paragraphStyle.headIndent = 15; // <--- indention if you need it
paragraphStyle.firstLineHeadIndent = 15; //首行缩进
paragraphStyle.lineSpacing = 7; // <--- magic line spacing here! 行间距
UIFont *font = xxx //
NSDictionary *attrsDictionary =
@{ NSFontAttributeName: font, //<-- if you need; & there are many more attrs
NSParagraphStyleAttributeName: paragraphStyle};
self.textView.attributedText = [[NSAttributedString alloc]
initWithString:@"Hello World over many lines!" attributes:attrsDictionary];
现在Xcode都默认使用storyboard了,和原先xib方式相比,有很直观的便利。
但一些问题也比较陌生,比如如何push到xib?
那把navigationController作为入口即可
如何push到自身?
部分情况下是需要一个跟自己类似的viercontroller的,比如大集合到小集合,只是范围不同,但展示方式一样
这时候不能用performSegueWithIdentifier了
因为自己不能做segue到自身
那可以这样:
第一个参数是storyboard的名称,第二个是给里面的页面起个Storyboard ID名称即可
如果是自身storyboard里的viewcontroller,会更方便些
PhotoAlbumViewController *initViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PhotoAlbum"];
push和pop都可以按往常一样使用
但一些问题也比较陌生,比如如何push到xib?
那把navigationController作为入口即可
如何push到自身?
部分情况下是需要一个跟自己类似的viercontroller的,比如大集合到小集合,只是范围不同,但展示方式一样
这时候不能用performSegueWithIdentifier了
因为自己不能做segue到自身
那可以这样:
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
PhotoAlbumViewController *initViewController = [storyBoard instantiateViewControllerWithIdentifier:@"PhotoAlbum"];
[self.navigationController pushViewController:initViewController animated:YES];
PhotoAlbumViewController *initViewController = [storyBoard instantiateViewControllerWithIdentifier:@"PhotoAlbum"];
[self.navigationController pushViewController:initViewController animated:YES];
第一个参数是storyboard的名称,第二个是给里面的页面起个Storyboard ID名称即可
如果是自身storyboard里的viewcontroller,会更方便些
PhotoAlbumViewController *initViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PhotoAlbum"];
push和pop都可以按往常一样使用