Tag: iphone

滚动到底部Facebook应用程序时,UITableView加载更多

我正在开发一个使用SQLite的应用程序。 我想使用分页机制来显示用户列表(UITableView)。 任何人都可以告诉我,当用户滚动到列表的末尾(如在Facebook应用程序的主页上)如何加载更多的数据在我的列表中?

iPhone核心数据“自动轻量级迁移”

我正在尝试更新一个实现核心数据存储的应用程序。 我正在为其中一个实体添加一个属性。 我将下面的代码添加到我的委托类: – (NSPersistentStoreCoordinator *)persistentStoreCoordinator { if (persistentStoreCoordinator != nil) { return persistentStoreCoordinator; } NSURL *storeUrl = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"Shoppee.sqlite"]]; NSError *error = nil; persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]]; NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:options error:&error]) { NSLog(@"Error: […]

如何在iPhone中着色透明的PNG图像?

我知道可以通过在其上绘制CGContextFillRect并设置混合模式来对矩形图像着色。 但是,我不知道如何做一个透明的图像,如图标色调。 它必须是可能的,因为SDK自己在这样的选项卡上执行它自己。 任何人都可以提供一个片段? 更新: 自从我原本提出这个问题以来,已经有很多很棒的build议。 一定要仔细阅读所有答案,找出最适合自己的方式。 更新(2015年4月30日): 使用iOS 7.0,我现在可以做到以下几点,这将满足我原来的问题的需要。 但是,如果你有更复杂的情况,请检查所有的答案。 UIImage *iconImage = [[UIImage imageNamed:@"myImageName"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; UIImageView *icon = [[UIImageView alloc] initWithImage:iconImage]; icon.tintColor = [UIColor redColor];

如何捕捉UIView顶部UIView

我有显示graphics的UIView ..现在我需要将其捕获到UIImage ,我GOOGLE了它,并得到了下面的code.but如果我在我的代码中使用它不工作。即使我使用断点编译器没有达到这个。我在我的UIView使用这个,我错了? + (UIImage *) imageWithView:(UIView *)view { UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0); [view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage * img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return img; }

从webservicesurl获取密码并通过该密码进行访问

我有一个Web服务URL附加访问码。 我需要将访问码发布到一个web服务url并获得json响应。 我得到正确的访问代码和不正确的访问代码的JSON响应。 我没有得到问题出现的地方。 当input错误的密码时,我需要显示警报,这里是我的代码。 NSString *post =[[NSString alloc] initWithFormat:@"txtsecurecode=%@",[txtsecurecode text]]; NSLog(@"PostData: %@",post); NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d",[postData length]]; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://my example.com/Accountservice/Security/ValidateAccess?accesscode=abcdtype=1"]]]; NSURL *url; // I need to parse it into url here . [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request […]

为什么弱的NSString属性不能在iOS中发布?

我写了下面的示例代码来看看ARC如何工作 @property (nonatomic, weak) NSString *myString; @property (nonatomic, weak) NSObject *myObj; @end @implementation ViewController @synthesize myString = _myString; @synthesize myObj = _myObj; – (void) viewDidAppear:(BOOL)animated { NSLog(@"Appearing Obj: !%@!",self.myObj); NSLog(@"Appearing String: !%@!",self.myString); } – (void)viewDidLoad { self.myObj = [[NSObject alloc] init]; self.myString = [[NSString alloc] init]; NSLog(@"Loading Obj %@",self.myObj); NSLog(@"Loading String: !%@!",self.myString); } 然而令人惊讶的是我得到了这些结果 2012-06-19 […]

仅限于iPhone 5 / 5s / 5c的用户将AppStore的应用程序安装限制在内

将添加到UIRequiredDeviceCapabilities“armv7s”和“armv8”限制用户从AppStore安装在iPhone 5 / 5s / 5c以外的设备上我的应用程序? 我发现这些文章非常有用: UIRequiredDeviceCapabilities和设备兼容性matrix (是否有任何有关设备function的Apple最新信息?) iOS设备列表 我也搜遍了所有的问题,对于我的问题没有完整的答案。 也许除了这一个: 限制只在iPhone5上的应用程序? ,但它应该(?)只适用于iPhone 5和iPhone 5C,而不是iPhone 5S。

限制用于App Store提交的某些iOS目标设备

由于运行在iPhone 4硬件上的问题,我的iTunes App Store提交反弹。 基本上,应用程序被编写为将所有联网活动放到后台线程,以便在等待服务器响应慢速(蜂窝)数据连接时,UI不会locking。 在iPad 2 + iPhone 4S这样的双核心设备上,这样做效果很好,但是在像iPad / iPhone 4这样的老式单核硬件上,响应速度慢,出错。 我在提交的内容中包含了这种效果的注释,但是我想知道是否有正式的方法来限制iTunes Connect中的目标设备? 干杯!

检测iOS应用程序进入后台

我正在使用Swift编写iOS游戏。 我试图find一种方法来检测应用程序进入后台模式或由于其他原因,例如打电话,但无法find任何东西中断。 我该怎么做?

试图读取Xcode Instruments .trace文件。 什么是.trace文件的文件格式?

我正在编写一个自动化的分析系统,在我的应用程序中分析不同的GPU密集屏幕。 我一直在尝试使用'XCode Instruments',用'OpenGL ES Driver'来捕获gpu的使用数据。 我的自动化系统从运行App的命令行运行Xcode Instruments,configuration文件并捕获数据,并将数据写入“.trace”文件。 我现在希望能够打开跟踪文件,并使用我的自动分析系统读取跟踪数据,以便我可以通知应用程序开发人员应用程序的各个部分如何执行。 我不能find任何方式来阅读跟踪文件。 它似乎是包含各种目录的包,并埋在那里有一个.zip文件,似乎包含一些二进制数据。 这个文件中的数据是如何分析的? 仪器系统似乎相当复杂,我很惊讶,它是多么难以访问它产生的跟踪数据。 有谁知道如何parsing跟踪文件? 我目前正在使用XCode 4.6.1