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/appname
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








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

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

    [[UIApplicationsharedApplication] openURL:requestURL];



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






sadasd

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值