objective-c

Using C Structs which contains ObjC Objects?

I'm using C structs in objc and I've created a function that assembles the structure like the one from the Cocoa API. The things is that this structure is not like NSRect o NSPoint this structure packs objc objects soo I'm seeing a potential memory leak here. Do I need to provide a function to 'release' the structure? I'am not creating ...

Sorting an array in ascending order without losing the index Objective-C

Hello all, I have an array for instance, Array { 3.0 at Index 0 2.0 at Index 1 3.5 at Index 2 1.0 at Index 4 } I would like to get sort it in ascending order without losing the index in the first place, like this, Array { 1.0 at Index 4 2.0 at Index 1 3.0 at Index 0 3.5 at Index 2 } When I so...

Monotouch stringWithFormat using a URL

I'm trying to learn the MapKit with Monotouch and I'm having difficulty figuring out how to search for an address. I finally found this snippet of Objective-C code that might help but it has a line where they use a URL to get a return value and I have no idea how to use this code in C#: NSString *urlString = [NSString stringWithFormat:...

How to enable iPhone auto lock during MPMoviePlayer playback?

When I play a video with MPMoviePlayerController in my app my iPhone does not auto lock (tested OS 3.0 & 3.1.2). However, the application.idleTimerDisabled = NO, so this setting is not affected by MPMoviePlayerController. How can I get my iPhone to sleep normally (e.g. after 3 min screen dims, then goes dark) when my app is running and ...

How to get the auto-lock setting from general settings on the iPhone?

Any chance? I want to know if it is set from "1 - 5 minutes" or set to "never". Thank you! ...

Crashes in Core Data's Inferred Mapping Model Creation (Lightweight Migration). Threading Issue?

I'm getting random crashes when creating an inferred mapping model (with Core Data's lightweight migration) within my application. By the way, I have to do it programmatically in my application while it is running. This is how I create this model (after I have made proper currentModel and newModel objects, of course): NSMappingModel *m...

Strike-through font in objective C

Hi, How can I use strike-through font in objective C??? More specifically in UITableViewCell cell.textLabel.text = name; cell.detailTextLabel.text = quantity ; cell.XXX = ?? ...

App crashes often in a for-loop

Hello, my app crashes often in this for-loop: for (int a = 0; a <= 20; a++) { NSString * foo = [[NSString alloc]initWithString:[[newsStories objectAtIndex:arc4random() % [newsStories count]] objectForKey:@"title"]]; foo = [foo stringByReplacingOccurrencesOfString:@"’" withString:@""]; foo = [[foo componentsSepara...

Why is UITableViewCell text floating to top on the device?

The text lables in my UITableViewCells are getting displayed differently on the device than on the sim. How do I fix it? ...

How to retrieve data from server and save into a file in [Objective-C] iPhone programming?

I've saved the contents of server into a NSData. How do I copy the contents of NSData into a file. ...

How to send sms and receive sms in Iphone sdk?

I want to implement SMS functionality in my application. Is there any way to do this, or any documentation to implement this functionality? Can anyone provide sample code for this? ...

Memory management for NSURLConnection

Sorry if this has been asked before, but I'm wondering what the best memory management practice is for NSURLConnection. Apple's sample code uses -[NSURLConnection initWithRequest:delegate:] in one method and then releases in connection:didFailWithError: or connectionDidFinishLoading:, but this spits out a bunch of analyzer warnings and ...

iPhone App rejected because of Three20 private API undocumented, private UITouch instance variables:

I got a notification mail after submitting my iphone application to apple store.. "During our review of your application we found it is using private APIs, which is in violation of the iPhone Developer Program License Agreement section 3.3.1; "3.3.1 Applications may only use Documented APIs in the manner prescribed by Apple and must no...

UITableViewHeader (fix position)

Hi, I added a UITableviewHeader to my tableview, is there a way to make it fix. I want to scroll with my TableView but always be able to watch the Header. thanks, ...

How to go to the app store (from within app) programmatically?

After clicking on a UIView I want to take the user of my app OUT of my app and to another app on the app store. How do i do it? ...

I am using CATiledLayer and UIScrollView, how can I dynamically set CATiledLayer properties?

Basically speaking I am making a map framework (like Route-me and Google Maps). I want to change some properties of CATiledLayers which are not documented. So I dont know if it is possible: I want to dynamically set properties of CATiledLayer, such as layer size, tile numbers, what conditions to trigger reloading tile source, and bindin...

How to control the color of a UIWebView (before contents load)?

I am trying to have a BLACK colored UIWebView before its contents load. In IB, i tried both making the background color of the UIWebView black, as well as, making it have a transparent background and have its parent view's background be black. Both don't work. When my UIWebView loads the background of it is white. How can I fix this? *I...

How do I release an object allocated in a different AutoReleasePool ?

Hi, I have a problem with the memory management in Objective-C. Say I have a method that allocates an object and stores the reference to this object as a member of the class. If I run through the same function a second time, I need to release this first object before creating a new one to replace it. Supposing that the first line of ...

How to detect touches on MPMoviePlayerController window and still having the standard playback controlling

Hello I have the MPMoviePlayerController set up to play a movie.I want to detect a touch on the movie for bringing up few buttons.I used the code : // The movie's window is the one that is active UIWindow* moviePlayerWindow = [[UIApplication sharedApplication] keyWindow]; // Now we create an invisible control with the ...

Core Data migration problem: "Persistent store migration failed, missing source managed object model."

The Background A Cocoa Non Document Core Data project with two Managed Object Models. Model 1 stays the same. Model 2 has changed, so I want to migrate the store. I've created a new version by Design > Data Model > Add Model Version in Xcode. The difference between versions is a single relationship that's been changed from to a one t...