iphone

How do I override the "view" property in UIViewController?

I have a custom UIViewController and custom UIView. I'd like to override the viewcontroller.view property to return MyCustomUIView. Right now I have: @interface MyViewController : UIViewController { IBOutlet MyView* view; } @property (nonatomic, retain) IBOutlet MyView* view; This compiles but I get a warning: property 'vi...

How to create view similar to AddressBook edit contact

Can anyone provide example of how to create contact view from address book. Mostly I am interested in: What UIKit class to use for Add Photo What class to use for editing Name and Company How to implement composite control where I am able to edit phone, ringtone Thx ...

How do I use a UIWebView in a Table Cell?

I'm building a table with some text that is HTML, so I am using a UIWebView as a subview of my custom table cells. I already ran into one problem - as I scrolled down in the table, it would take the UIWebViews a second to update. For example, I'd be viewing Cells at rows numbered 1, 2, and 3. I'd scroll down to say 8, 9, and 10. For a mo...

How do I accurately time how long it takes to call a function on the iPhone?

I would like to know how long it's taking to send a message to an object with at least a 1ms accuracy. How do I do this? ...

Multiple Hierarchy levels with navigation Controller

I'm trying to get multiple levels of hierarchy working with Navigation Controllers. I have 3 levels of hierarchy and I can move down through the levels of hierarchy, but I can only go back one level and not two levels, back to the starting view. I start by creating a navigation controller for View #1 and push the next view, View #2, o...

Using TouchScreens for game control

I'm working on my first video game for the Android platform as a bit of a nights and weekends project. It is coming along nicely, but I am very unhappy with the control sensativity. In this game, you move an object left and right on the screen. On the bottom of the screen is a "touchpad" of sorts, which is where your finger should rest...

How do I detect a touch over a specific area

Currently I see that a touch event will show me the UIView where the touch occured. But what if I need to detect a touch of some non rectangular shape, like a circle. How would I go about doing something like that ? Basically I want to do something only if the user touches somewhere within a circular area that's not visible. Any help/...

deep copy NSMutableArray in Objective-C ?

Hi All, Is there any built-in function in Objective-C allows me to deep copy a NSMutableArray? I looked around, some people say [aMutableArray copyWithZone:nil] works as deep copy. But I tried it seems no. Right now I am manually doing the copy one by one (a 9*9 array): //deep copy a 9*9 mutable array to a passed-in reference array ...

HTTP date format to NSDate

I have a date string (well, NSData, but that's easy to convert to a string) that's in what I believe is the format the HTTP standard uses: Mon Apr 17 19:34:46 UTC 2006 Is there any better (i.e. less error-prone) way to parse that than specifying the format string by hand in an NSDateFormatter? (My application is an iPhone app, but I ...

NSDictionary leak on iPhone and object reference graph

I am simply loading a plist into a temporary dictionary for initializing my data model. Unfortunately this single line of code below results in consistent leak throughout the app life cycle as per Instruments. The leaked objects being NSCFString and GeneralBlock on a Malloc and the responsible library being Foundations. My two questions...

Cocoa or Objective-C?

In regards to iPhone development, how do you now when your using a Cocoa vs pure Objective-C objects. For example, the following are Objective-C: NSTimer NSString int, float NSMutableArray But these are Cocoa: UILabel UIColor(?) UIView And to be clear, does Cocoa Touch == iPhone development Cocoa == Mac OS X development ...

iPhone - Importing/Exporting App data?

iPhone apps are great for managing or viewing small elements of data however doing mass and/or long data entry or typing is a pain. For apps that need to have longer dynamic data that can be used on the iPhone but more easily created at the desktop, what sort of options exist for getting data from the desktop to the iPhone app? Are web...

How to properly release and switch views in multiview controller?

I'm trying to create a multiview controller for a game, in which one root view controller releases views before switching to another view. The sub view controllers are, in turn, sub-root view controllers themselves since they contain other view controllers. For instance, my singlePlayerViewController will have a shakeObjectViewControlle...

Best Method of Persisting Custom Objects

Hey guys, I have a custom object that simply inherits from NSObject. It has 3 members - two floats and an NSDate. My app is going to have an array with a number of these objects kicking around, and I need to persist it between runs. What is the best way to accomplish this? I've thought about using the SQLite db, but I'm thinking that ...

array of ints

im struggling to create an array of ints in objective c. the way I'd do this is javascript would be: arr = new Array ( 1, 2, 3, 4, 3, 2, 2 ); i need to use an nsmutablearray, as the values need to be updated (it's a tile map for a game). any help? ...

Best way to download large files from web to iPhone for writing to disk

In an iPhone app I currently have code for downloading a file from the Web to the iPhone and saving it to disk. The problem is that if the file is large then the memory usage of the app skyrockets and the app crashes. I am sure I am just not doing it the "proper" way. Currently I have the following: mediaData = [[NSData alloc] initWi...

Does UIWebView leak memory?

If your iPhone app uses a UIWebView, and loads many pages with large images, you may find that you are leaking memory. Can this be resolved? ...

Difference between directly setting a controller's view and adding view as a subview

I have just started learning objective-C and the iphone sdk and I have a question that I hope someone can help shed some light on. What is the difference in the following: self.view = someView; and [self.view addSubView: someView]; Say for example, in a simple app, where we have only one controller and one container view (has a fe...

Is this all for Garbage Collection in Objective-C?

Hi I just picked up Obj-C and quite dislike its manual memory management. I decide to go with its Garbage Collection, by adding objc_startCollectorThread();//garbage collection in my Main() and change the garbage collection value to [-fobjc-gc] So is that all I need? So I can program "freely" like I do in Java/Python..etc? ...

From Fraction to Decimal and Back?

Hi folks... Is it possible to store a fraction like 3/6 in a variable of some sort? When I try this it only stores the numbers before the /. I know that I can use 2 variables and divide them, but the input is from a single text field. Is this at all possible? I want to do this because I need to calculate the fractions to decimal odds. ...