ios 系统相干
ios 系统相关
UIRequiresPersistentWiFi Boolean true
To send customers to a specific app with your company name included in the URL:http://itunes.com/apps/developername/appname
[[UIApplicationsharedApplication] openURL:requestURL];
关闭后台运行
iOS 4引进了所谓多任务,可以让程序运行于后台,不过对目前大部分程序而言这只是一个鸡肋。有没有办法直接在用户按下Home键后像iOS 4之前的程序一样直接退出呢?方法如下:
判断当前设备 是否ipad
#define isIPad UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
剪贴板
得到剪贴板
UIPasteboard *pasteboard=[UIPasteboard generalPasteboard];
把一个字符串放置到剪贴板上: //用户此后在输入框 粘贴的就是这个字符串
pasteboard.string = @"Hello World";
从剪贴板获取字符串:
UIPasteboard *pasteboard=[UIPasteboard generalPasteboard];
NSString *myString=pasteboard.string;
在iphone模拟器截屏
打开模拟器 按住ctrl键打开编辑菜单,里面会有拷贝屏幕这一项,
然后打开预览 文件-》从夹纸板新建
添加静态库
把***.a文件拖到项目的framework里面
把头文件路径添加到header search path里
拿到app的documents路径
NSString *appDocDir = [[[[NSFileManagerdefaultManager] URLsForDirectory:NSDocumentDirectoryinDomains:NSUserDomainMask] lastObject] relativePath]; 另一种写法 NSString *appDocDir = [[[[NSFileManagerdefaultManager] URLsForDirectory:NSDocumentDirectoryinDomains:NSUserDomainMask] lastObject] relativePath]; NSArray *contentOfFolder = [[NSFileManagerdefaultManager] contentsOfDirectoryAtPath:appDocDir error:NULL]; for (NSString *aPath in contentOfFolder) { NSLog(@"apath: %@", aPath); NSString * fullPath = [appDocDir stringByAppendingPathComponent:aPath]; BOOL isDir; if ([[NSFileManagerdefaultManager] fileExistsAtPath:fullPath isDirectory:&isDir] && !isDir) { [fileList addObject:aPath]; } }NSURL *home = [[[NSFileManagerdefaultManager] URLsForDirectory:NSDocumentDirectoryinDomains:NSUserDomainMask] lastObject];
NSURL *imaurl = [NSURLURLWithString:@"img2.jpg"relativeToURL:home];
让app支持itunes传文件
Add the
UIFileSharingEnabled
key to your application’s Info.plist
file and set the value of the key to YES
判读当前是否横向
if (UIInterfaceOrientationIsLandscape([UIDevice currentDevice].orientation)) {
如果你的程序中用到了WiFi,想在没有有效WiFi的时候出现如图所示的提示该怎么做?
UIRequiresPersistentWiFi Boolean true
图标不要光环
UIPrerenderedIcon YES
免费程序中链接你的收费app
To send customers to a specific application: http://itunes.com/apps/appname
To send customers to a list of apps you have on the App Store:http://itunes.com/apps/developername
A tip is to use itms:// instead of http://, then it'll open in the app store directly. On the iPhone, it will make 2 (!) redirects when using http, and 1 when using itms.
White space in app name should just be removed
http://developer.apple.com/library/ios/#qa/qa1633/_index.html
代码中调用safari 可实现跳转到app store!
NSURL *requestURL = [NSURLURLWithString:@"http://www.163.com"];
关闭后台运行
- 打开info.plist
- 加入 UIApplicationExitsOnSuspend 或者选择“Application does not run in background(程序不运行于后台)”
- 将其设为 YES
sadasd