ios5

iOS - how do I create a “utility” class that all my controllers can call

谁都会走 提交于 2019-12-30 00:41:45
问题 I am new to iOS and obective-c so I am not too sure how to best accomplish this seemingly simple task. What I want is to make a class that looks like this in pseudocode: class UtilityClass { // Have a method that I can pass parameters to String doCalculation ( String art1 , String arg2 ) { return arg1 + arg2; } } My uncertainty is: 1) xCode seems to be inclined to lay out my file structure in a relatively flat way. So should I make a utils directory and have this file be under utils/fileName

iAd below UITableViewController inside UINavigationController

天大地大妈咪最大 提交于 2019-12-30 00:41:06
问题 I'm building an app for a blog site. I have a UINavigationController with a UITableViewController as it's root view. I laid this out in a storyboard no problem, but I'm trying to drag an iAd view to the bottom of the screen and xcode will not let me add it. It looks like I have to switch from a subclass of UITableViewController to a subclass of UIViewController, and just put my delegate and datasource methods in my subclassed UIViewController. This seems wrong to me. I'm just trying to end up

Supporting iOS 4.3 to iOS 6.0

佐手、 提交于 2019-12-29 09:27:10
问题 I already have the base code that supports ios 4.3 to ios 5. Now I would also like to support ios 6.0. The present base code has modal views , hard coded CGRect's , and rotation is different for each view. So I would like to know whether we can support ios 4.3 to ios 6.0 with the same base code, by just tweaking some changes, or do we need to create a complete new target? Like we cannot use auto layout of ios 6.0 if I want to support previous versions as it will lead to a crash. 回答1: Yes, we

Add extra row to a UITableView managed by NSFetchedResultsController

送分小仙女□ 提交于 2019-12-29 08:32:47
问题 I'm using a UITableViewController for a table in my app, and I've added an NSFetchedResultsController to provide the data to show in the table (setting self as it's delegate). However I would like to add a unique cell as the last cell of the table, unrelated to the items produced by the NSFetchedResultsController 's predicate, I want this cell to always be at the bottom of the table. I've tried simply added 1 to these methods in the table view data source: - (NSUInteger

Add extra row to a UITableView managed by NSFetchedResultsController

孤者浪人 提交于 2019-12-29 08:32:20
问题 I'm using a UITableViewController for a table in my app, and I've added an NSFetchedResultsController to provide the data to show in the table (setting self as it's delegate). However I would like to add a unique cell as the last cell of the table, unrelated to the items produced by the NSFetchedResultsController 's predicate, I want this cell to always be at the bottom of the table. I've tried simply added 1 to these methods in the table view data source: - (NSUInteger

Add extra row to a UITableView managed by NSFetchedResultsController

为君一笑 提交于 2019-12-29 08:32:09
问题 I'm using a UITableViewController for a table in my app, and I've added an NSFetchedResultsController to provide the data to show in the table (setting self as it's delegate). However I would like to add a unique cell as the last cell of the table, unrelated to the items produced by the NSFetchedResultsController 's predicate, I want this cell to always be at the bottom of the table. I've tried simply added 1 to these methods in the table view data source: - (NSUInteger

Objective-C String(yyyy-mm-dd) to NSDate

纵饮孤独 提交于 2019-12-29 08:10:09
问题 My App is a JSON code which involves a date in string type. (Such as "2011-10-01"). I would like to know how I could conver it into NSDate? It needs to be displayed in a different time format such as "1 October, 2011". ex. this code doesn't work: NSString *date1 = @"2010-11-12"; NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"yyyy-MMMM-dd"]; NSDate *date2 = [dateFormat dateFromString:date1]; NSString *strdate = [dateFormat stringFromDate:date2]; 回答1:

MGTwitterEngine crash in iOS5

删除回忆录丶 提交于 2019-12-29 07:47:08
问题 While MGTwitterEngine works well on previous versions of iOS, it failed with EXC_BAD_ACCESS at moment when I try to post twit: [twitter sendUpdate:textToShare]; The last list of Objective-C code executer is: [theRequest prepare]; inside SA_OAuthTwitterEngine.m. This is call stack: #1 0x00045a63 in -[OAMutableURLRequest URLEncodedString:] at /Users/ben/Dropbox/Dev/External Projects/Twitter-OAuth-iPhone/OAuthConsumeriPhoneLib/OAuthConsumerSrc/OAMutableURLRequest.m:287 #2 0x000445fa in -

How to hide folders created in Document Directory in ios?

南笙酒味 提交于 2019-12-29 06:55:07
问题 I have created some PDF files programatically, which i am storing into the devices memory using the following code >>>> NSString *fileName = [NSString stringWithFormat:@"SampleTextFile.pdf",strFinalString]; NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *saveDirectory = [path objectAtIndex:0]; NSString *saveFileName = fileName; NSString *documentPath = [saveDirectory stringByAppendingPathComponent:saveFileName]; I can see the file in

Using UIPopoverBackgroundView class

我们两清 提交于 2019-12-29 06:16:08
问题 Apple is missing documentation on how to use UIPopoverBackgroundView class introduced in iOS5. Anyone have an example? I have tried to subclass it, but my XCode 4.2 on Lion is missing UIPopoverBackgroundView.h Edit: Unsurprisingly, it should have been imported as #import <UIKit/UIPopoverBackgroundView.h> 回答1: To add to the other, link-only answers, here is how this is done. Create a new subclass of UIPopoverBackgroundView Declare the following in your interface: +(UIEdgeInsets