1.其实很简单,直接找到官方的关于 App Icons 和 App launchImage的示例进行对比。另外,如果你的.png图片去掉alpha依然有问题,那就改成.jpg图片吧。不要浪费宝贵的时间。
1.点击按钮振动
//点击按钮振动事件
导入#import <AudioToolbox/AudioToolbox.h>
在按钮点击事件中,加入以下代码
//AudioToolBox.framework下的 点击振动
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
2.字符串的使用
//获取地址
NSString *filePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"zhiKuCaiDesc.txt"];
//获取字符串 读取内容的方式
1.ffilepath转化为字符串
NSString *str = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
2.转化为二进制 二进制转化为字符串
NSData *data = [NSData dataWithContentsOfFile:filePath];
NSString *str=[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
textView.text = str;
3.重新登录的几种方式
1.present 到viewcontroller
MPLoginViewController * loginVC =[[MPLoginViewController alloc]init];
MPNavigationController * nav = [[MPNavigationController alloc]initWithRootViewController:loginVC];
loginVC.isPresentViewController = YES;
[self.window.rootViewController presentViewController:nav animated:YES completion:nil];
返回的时候 用dismiss
2.[self.navigationController pushViewController:VC animated:NO];
//获取Window当前显示的ViewController
- (UIViewController)currentViewController{
//获得当前活动窗口的根视图
UIViewController vc = [UIApplication sharedApplication].keyWindow.rootViewController;
while (1)
{
//根据不同的页面切换方式,逐步取得最上层的viewController
if ([vc isKindOfClass:[UITabBarController class]]) {
vc = ((UITabBarController)vc).selectedViewController;
}
if ([vc isKindOfClass:[UINavigationController class]]) {
vc = ((UINavigationController)vc).visibleViewController;
}
if (vc.presentedViewController) {
vc = vc.presentedViewController;
}else{
break;
}
}
return vc;
}
- if (iOS7) {
// 声明这张图片用原图(别渲染)
selectedImage = [selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
}
//防止图片变成蓝色
3.[IOS/UINavigation]隐藏UINavigationBar的返回文字
http://blog.csdn.net/zheng_paul/article/details/51206507
返回首页
1.遍历所有的自控制器
for (UIViewController* v in self.navigationController.viewControllers) {
if ([v isKindOfClass:[BuyVC class]]) {
[self.navigationController popToViewController:v animated:YES];
}
}
2.//获取Window当前显示的ViewController
- (UIViewController)currentViewController{
//获得当前活动窗口的根视图
UIViewController vc = [UIApplication sharedApplication].keyWindow.rootViewController;
while (1)
{
//根据不同的页面切换方式,逐步取得最上层的viewController
if ([vc isKindOfClass:[UITabBarController class]]) {
vc = ((UITabBarController)vc).selectedViewController;
}
if ([vc isKindOfClass:[UINavigationController class]]) {
vc = ((UINavigationController)vc).visibleViewController;
}
if (vc.presentedViewController) {
vc = vc.presentedViewController;
}else{
break;
}
}
return vc;
}
网友评论