objective-c

UITextView content not appearing in UIAlerView

The content is about 230 lines. It does not appear in UITextView except when you click on it AND try to scroll down. Otherwise, it is a white blank view. Any ideas why? UITextView *termsOfService = [[UITextView alloc] initWithFrame:CGRectMake(20.0, 100.0, 245.0, 170.0)]; termsOfService.text = responseString; termsOfServic...

When is 'drawRect' called?

I have some custom drawing code in drawRect which also performs some calculation of sizes. When is the earliest I can be sure that this code has been loaded, e.g. if I want to modify it's containers size accordingly? ...

Objective-C: How to create a method that will return a UInt8 array from an int

I need to create an Objective-C method that converts an int into a byte array. In this instance, I can't use NSArray as a return type, it must be an UInt8 array. I've written a simple method to do this, but it has errors during compile and tells me that I have incompatible return types. Here is the code snippet. Any ideas? - (UInt8...

UIButton: how to center an image and a text using imageEdgeInsets and titleEdgeInsets?

Hello, guys. If I put only an image in a button and set the imageEdgeInsets more close to the top, the image stays centered and all works as expected: [button setImage:image forState:UIControlStateNormal]; [button setImageEdgeInsets:UIEdgeInsetsMake(-15.0, 0.0, 0.0, 0.0)]; If I put only a text in a button and set titleEdgeInsets more...

Unselected UIPickerView value

According to the documentation, if a UIPickerView has no selected value, the expected return from selectedRowInComponent: should be: "A zero-indexed number identifying the selected row, or -1 if no row is selected." However, if I check the value the very line after initializing one, its value is 0. Even if I then manually set it t...

NSPredicate to exclude NSManagedObjects that haven't been saved in an NSFetchedResultsController

Building on this question, I've managed to use undo groups and a single managed object context to handle adding a Cocktail that can reference existing Ingredients and/or Brands. Now I'm stuck with a UI nit -- in the fetched results controller (sorted by cocktail.name) you can briefly see an empty row for the to-be-added Cocktail. Marcus...

Faking a dynamic schema in Core Data?

From reading the Apple Docs on Core Data, I've learned that you should not use Core Data when you need a dynamic schema. If I wanted to provide the user the ability to create their own properties, in a core data model would it work if I created some "dummy" attributes like "custom decimal 1", "custom decimal 2", "custom text 1", "custom...

NSData is being truncated when stored in sqlite database.

I am attempting to store NSMutableDictionaries as a blobs in sqlite, by first converting it into NSData via either NSPropertyListSerialization or NSKeyedArchiver. When I store the blob, the NSData object's length is in the thousands (KB range). When I get it back, it's been truncated to 10 bytes. When I check the DB through SQLite Brow...

How do I actually use Authorization Services?

I've been searching and experimenting for nearly four hours now, so I'm gonna just ask straight up: How can I correctly use the Authorization Services API to show the user a system-level authorization window, the same one you see when you click a lock icon in System Preferences? From what I can tell, there is no way to do it using Coco...

Asterisk sometimes on variable type, sometimes on variable name. Why?

In Objective-C, I've seen, for example: UIPickerView *tweetPicker and UIPickerView* tweetPicker What does the asterisk mean (I know, the first part is a dupe...) and why does it go on different parts of the deceleration in different contexts? ...

How to get arc4Sin() output into label/NSString

I'm trying to take the output of arc4sin and put it into a label. (EDIT: You can ignore this and just post sample code, if this is too irrelevant.) I've tried: // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; NSString *number = [[NSString...

convert Gmt timezone to CET in iPhone?

I want to convert GMT +530 to CET (Central European Time) in iPhone sdk? does anybody have idea about this? also tell me what is the time difference between these two? Means if time is 10 am in gmt +530 then what it will be in CET? ...

ABPerson in Core Data

I'm trying to figure out to store a reference to an ABPerson in a Core Data store on an iPhone app. Ultimately, I'd like to be able to sync with a Mac version of the app (I'm assuming ABRecordIDs wouldn't be the same for the iPhone and the Mac). I was thinking of storing the record ID, name, and email and checking against those--is the...

Resume download functionality in NSURLConnection

I am downloading some very large data from a server with the NSURLConnection class. How can I implement a pause facility so that I can resume downloading? ...

NSKeyedArchiver save method ( that i made) crashed the iphone simulator

i saw this approach on a tutorial, and the message is working for their example but when i implement this it does not work. from what i can tell the iphone simulator crashes when i do a [ self saveSettingsData]. TheSettings is class object that i declare and initialize in the appdelagate with these methods. the error says terminating due...

Cocoa Core data filename?

I followed Apple's example for creating a managed object which btw was great... http://developer.apple.com/cocoa/coredatatutorial/index.html However I now want to know what "name" (filename) the user saved his data as. Does anyone know how to pull the filename from the core data object. something like this would be great... NSLog (@...

Handling Special Characters in Json parser in Objective C

Can any one tell how we can handle html escape codes for special characters like & and ' while using Json Parser. I am using SBJson Parser. The web service content - term_data: { * title: "News & Politics" * tid: "49" } Here the actual content should be News and Politics for title. ...

Simple string pattern matching

What's the easiest way of doing simple pattern matching a la .something.com something.com/ something.com/somefolder/*.jpg in the iPhone SDK? At this point it looks like I'm going to have to use a regular expression library of some sort, which is really overkill when all I need is simple wildcard matching. None of the standard NSString me...

UIButton Transition Curl Up problem

Hello again SO peeps! Basically, I am trying to UIViewAnimationTransitionCurlUp a UIButton. The animation works perfectly but the button stays there. i.e. The button curls up, but there is another instance of the button still underneath. My code as follows: [UIButton beginAnimations:nil context:nil]; [UIButton setAnimationDuration:0...

Adding a UINavigationController to a UITabBarController

I have a set of 10 navigationViewControllers i want to the UITabBarController this all just works fine except the fact when i want to see a UINavigationController that is in the "more" tab it doesn't switch to it. it does nothing. if i change that to a UIViewController it just works fine .. ok in the more tab you automatically have a UI...