cocoa-touch

When we should use pushScene and replaceScene?

Hi, I cocos2d, I am using pushScene and replaceScene to move to next scene. But, I am confused which we should use? When I am using replaceScene in some places app is crashing and giving errors like -[UITextView length]: unrecognized selector sent to instance 0x842a750 Terminating app due to uncaught exception 'NSInvalidArg...

Adjust UIScrollView scrolling threshold

Hi all, I have an UIView-derived class (MenuView) that handles touch events inside an UIScrollView. Small finger movements are properly captured by MenuView; sweeps are captured by the outer UIScrollView and translate into scrolling. The MenuView gets a [touchesCancelled] notification. Apparently a decision is made within UIScrollView ...

API to determine whether running on iPhone or iPad

Is there an API for checking at runtime whether you are running on an iPhone or an iPad? One way I can think of would be to use: [[UIDevice currentDevice] model]; And detect the existence of the string @"iPad" - which seems a bit fragile. In the 3.2 SDK, I see that UIDevice also has a property which is really what I'm looking for, b...

Memory leak for NSDictionary loaded by plist file

I have a memory leak problem that just can not understand! Watch this initialization method: - (id)initWithNomeCompositore:(NSString *)nomeCompositore nomeOpera:(NSString *)nomeOpera { if (self = [super init]) { NSString *pathOpere = [[NSBundle mainBundle] pathForResource:kNomeFilePlistOpere ofType:kTipoFilePlist]; NSDictionar...

Scaling MKMapView Annotations relative to the zoom level

The Problem I'm trying to create a visual radius circle around a annonation, that remains at a fixed size in real terms. Eg. So If i set the radius to 100m, as you zoom out of the Map view the radius circle gets progressively smaller. I've been able to achieve the scaling, however the radius rect/circle seems to "Jitter" away from the P...

IPhone Example : Login Page and then Navigate to another Screen (UI Table View)

Hi, I am an .Net Expert but a new to the IPhone App Development. Recently I have started workinf on Objective - c. I need a help I need a example which shows a Login Screen and then Navigates to the another Screen (UITableView) when username and password and found correct. As of now I am assuming that username and passwords are hardco...

What's the best way to call an IBAction from within code?

Say for instance I have an IBAction that is hooked up to a button in interface builder. - (IBAction)functionToBeCalled:(id)sender { // do something here } Within my code, say for instance in another method, what is the best way to call that IBAction? If I try to call it like this, I receive an error: [self functionToBeCalle...

Stop NSXMLParser Instance from Causing _NSAutoreleaseNoPool

Hi Everyone: In my iPhone application, I have an instance of NSXMLParser that is set to a custom delegate to read the XML. This is then moved into its own thread so it can update the data in the background. However, ever since I have done this, it has been giving me a lot of _NSAutoreleaseNoPool warnings in the console. I have tried ...

objective-c releasing uninitialized class members in dealloc method

Regarding over-releasing. Say I have a instance variable defined in Test.h NSString *mystring; In my implementation Test.m I do not initialize the variable mystring anywhere. But I release it in dealloc: -(void)dealloc { [mystring release]; } Is this now over-released? I've been doing the following in dealloc to avoid any issue...

objective-c over-releasing in dealloc

Is mystring over-released? -(void)dealloc { [mystring release]; [mystring release]; [super dealloc]; } I assume this will not based on [nil release] does nothing: -(void)dealloc { [mystring release]; mystring = nil; [mystring release]; [super dealloc]; } -EDIT- Let's say I allocate mystring in init and r...

Accessing controls from implementation class

I develop a game that has a big number of buttons (25). I want to know if i can access them without initiating them in interface (.h) in my implementation class. ...

How to get title of UITabBarItem in the More section?

I have a UITabBarControllerDelegate method that determines the title of the UITabBarItem and does something accordingly. This works well for items in my UITabBar but when I click on the More button the rest of my UITabBarItems are in a UITableView. How can I determine the title in the More section? - (void)tabBarController:(UITabBarCont...

UINavigationController does not set view properties correctly when pushed

I have a UITabBarControllerDelegate that pushes a new view controller when a certain tab is pressed: - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { MyView* myView = [[[MyView alloc] initWithNibName:@"MyView" bundle:nil]autorelease]; if([self.tabBar...

iPad application always opens in portrait mode

The app uses a UISplitView and it always opens in portrait mode. If the iPad is held horizontally it will open in portrait mode and then rotate to landscape. I'd like it to just open up in landscape mode without needing to rotate. Any ideas> ...

How to get cell text based on indexPath?

I have a UITabBarController with more than 5 UITabBarItems so the moreNavigationController is available. In my UITabBarController Delegate I do the following: - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { //do some stuff //... UITableView *moreView = (UITab...

CALayer and UIView display order

I have a CATiledLayer within a UIView and the UIView also contains a subview. How can I make sure that the subview is always drawn above the layer? Most of the time I get the tile layer covering the subview. ...

Accessing the music files in iPhone

I need to build a system which backup and restore system in which all the phone datas including audio, video, pictures. From iPhone 4.0 , there is support for accessing the videos and photos from the library . Is there any way to access the music files. I need to convert those music files into binary format . Is there any way to accomp...

MKReverseGeocoder delegate location?

I have a quick question regarding memory management that I am not quite sure about. I currently have a locationManager delegate that calls locationManager:didUpdateToLocation:fromLocation where it resolves the device location. My question is I am looking at adding ReverseGeoCoding after I have obtained the [newLocation coordinate] but am...

Can two iPhone aplications communicate with each other?

Hi all, Is it possible for two iPhone apps to communicate with each other by any means like sending messages etc? EDIT: Also is there any way a system app can communicate with our app? For example: If I want to play a sound when I receive a phone call, then is it feasible? Thanx in advance. ...

TabBar / "More View Controller" - Possible to have icons in colors other than black?

Hi, Is it possible to have the icons in a TabBar and / or the "More navigation controller" be in colors other than grey and black? I tried changing the color of the icon I set for the view controller using UITabBarItem's - (id)initWithTitle:(NSString *)title image:(UIImage *)image tag:(NSInteger)tag method. My client thinks the inte...