cocoa-touch

disable UINavigationBar gradient

Does anybody know how to disable gradient in UINavigationBar and make it totally black? ...

How can I use OCMock objects with code that calls isKindOfClass ?

Hi, I'd like to test some code with OCMock. The innards of the code are calling [NSObject isKindOfClass] on the mock object I'm providing to the code, like so: if ([object isKindOfClass:[FancyClass class]]) { ...} However, when I provide an OCMockObject-based mock created like this: mock = [OCMockObject mockForClass:[FancyClass clas...

How to : Navigation Controller in Tab Bar Controller

Hi I'm woking on a simple iphone application. The applicaton has a table view on first screen. If the user clicks on an item on that table view, application navigates to the second view. The second view has a table view, too. If the user clicks on an item on this screen, I want to show a new xib which has Tab Bar Controller. Actually, ...

How to create multiple thread

Hi I want to create multiple thread in my game. One thread is for timer and other for touch event. Because when i am running this game on iphone timer conflict the touch events so touch event will not be detected. Its working smooth on iphone simulator but on iphone or on itouch its became very slow. So i m using thread for touch and ...

" NSRangeException " problem

I am trying to build an iPhone app. But at the time of compiling there is a message showing that [Session started at 2009-01-29 18:25:40 +0600.] 2009-01-29 18:25:44.238 SimpleGame[3691:20b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (1) beyond bounds (0)' 2009-01-29...

Does Interface Builder use the -init method to initialize view controllers?

I have setup tab bar controller using interface builder, and each tab bar item is linked to a view controller (4 tabs, 4 view controllers). I want to know if Interface Builder uses an -init method to initialize the view controller because apparently this method does not get called: - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(...

Multiple UiTableViewCell subclasses in a single UiTableView? Why is this code not working..

Okay so Here's my issue. I have a table, a bit like Apple's addressBook.app that uses different cell subclasses to display information in different ways. On this particular app I have 3 different UiTableViewCell subclasses, all with their own nibs. I can't get the code right :-( if I try and access the instance variable of my cell in th...

Do you tag your UIViews or retain them as properties?

This is mostly a stylistic question but I've been curious what others' thoughts are since I started programming for the iPhone. When you have a UIView in your iPhone application and you need to access it elsewhere in your application (generally in another function in a view controller), do you like to tag the view with an integer and re...

Best way to create Default.png image for iPhone app

Originally I though I'll just take a screenshot of my app on the iPhone then tweak it in Photoshop. The images should be 480 x 320 according to Apple doc, and the dimensions of my screenshot are 480 x 320. But, the screenshot contains notification area (where reception bars, battery life, etc. are displayed) So, if I chop that part of...

Removing views from UIScrollView

I have two UIScrollViews that I move images between. The user can drag and forth between the scroll views. I am trying to animate the movement of the image from one scroll view to another. In -touchesMoved (handled in my UIViewController which has two custom UIScrollViews that intercept touch and sends to my UIViewController), I am tryin...

On Objective-C/Cocoa Key-Value coding and arrays...

I'm trying to work out the "correct" way to handle populating an array with key-value coding for an iPhone app. I've come up with something that works, but it's fairly hackish. Basically I'm parsing an XML document into a set of code-generated models. Let's assume the XML is of this format: <foo> <bar> <item name="baz" />...

XML with Cocoa Touch

I am a new learner at the area of Objective-C. I would like to retrieve data from XML page on the iPhone. Is it possible? It would be more helpful to me if I get an appropriate suggestion or code. ...

UINavigationBar tintColor with gradient

I'd like to change programmaticaly the tintColor of a UINavigationBar and keep the gradient as in Interface Builder. When I change the tintColor in my code, the gradient disappears but when I change the tintColor in Interface Builder, the gradient is kept. Any ideas? ...

Uploading image issue (UIImageJPEGRepresentation vs UIImagePNGRepresentation)

I have stored a few pictures using Safari's "Hold + Save Image" option to my Photo Library in simulator. When I pick an image from the library, I have to convert it to JPEG or PNG so I can upload it to the server. Issue is that the size of original image is around 200 KB but the image after converting to PNG is around 2 MB. I'm using UII...

Moving a UITextField in a UITableViewCell

I have the need of being able to move a UITextField around within a UITableViewCell. Just to have it in the cell and use it works until I'm trying to actually move it. The problem is that when I try to move it, it does not get repositioned!!!! I have it added to the cell as a subview of the cell's contentView. So, I have tried the foll...

How to access emails from contacts app in your application?

I need to send emails to a list of IDs from the contact application, from my application. Is there a way to access the contacts? ...

Trap backspace key on the iPhone

Hi, On the iPhone, I've tried to find a way to trap and act upon the backspace key pressed event. But cannot find a way to do that!! There sure must be one such way documented in the SDK right? /John ...

iPhone SDK - Converting project from 2.1 to 2.2.1

I just read in an online article that 2.2.1 does not support previous sdk. I wonder what that means? I just downloaded 2.2.1 and want to use updated/latest API's framework. How can i convert my project so that it uses updated/latest API's/Frameworks in version 2.2.1? Are there any special steps required OR should i just 1.) delete 2.1 a...

Changing the UIBackButtonItem title

I have a navigationController-based app. I want to change the title of the back button for the root view controller. I have tried the following code in the rootViewController's viewDidLoad method, but no success: self.navigationItem.backBarButtonItem.title = @"Back"; Any ideas? ...

Multiview application

HI I have one rootViewController. When apllication start load mainViewController as subview on rootController. I want to switch view and load settingsViewController as subview on rootView and remove mainView. When take some action, i want to remove settingsView and load mainViewController. I try with CATransition, UIView animation but...