首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

ios 系统相干

2012-08-31 
ios系统相关??判断当前设备 是否ipad?#define isIPad? UI_USER_INTERFACE_IDIOM() UIUserInterfaceIdio

ios 系统相关

?

?

判断当前设备 是否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

To send customers to a specific app with your company name included in the URL:http://itunes.com/apps/developername/appnameA 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 removedhttp://developer.apple.com/library/ios/#qa/qa1633/_index.html







代码中调用safari 可实现跳转到app store!

? ??NSURL *requestURL = [NSURLURLWithString:@"http://www.163.com"];

? ? [[UIApplicationsharedApplication] openURL:requestURL];


关闭后台运行
???iOS 4引进了所谓多任务,可以让程序运行于后台,不过对目前大部分程序而言这只是一个鸡肋。有没有办法直接在用户按下Home键后像iOS 4之前的程序一样直接退出呢?方法如下:
    打开info.plist加入?UIApplicationExitsOnSuspend?或者选择“Application does not run in background(程序不运行于后台)”将其设为 YES






sadasd

?

热点排行