objective-c

Function works even after pool drain please help

we add an object to the pool and when the pool is drained the objects are flushed out of memory, and if i don't add them into the pool they will remain into the memory and can be accessed after the calling of pool drain method. What i have done in my code is that i have not added the object of my class into the pool and have called the m...

Method Overloading in Objective-C - not used for init?

I have just started programming in Objective-C, I understand it only partially supports method overloading due to the way the method names are generated (see this question). However, my question is why I have never seen it used in any examples. The code below seems to work fine, but any sort of example I have seen, the second init would...

How can I convert an RGB integer to the corresponding RGB tuple (R,G,B)?

How can I convert an ARGB integer to the corresponding ARGB tuple (A,R,G,B)? I receive some XML where a color tag is given with some integer value (e.g -16777216). I need to draw a rectangle filled with that color. But I am unable to retrieve values of the A,R,G,B components from the integer value. ...

How to load a nib from a customized UIView?

I have a nib call "Hello.xib", and I have a HelloView that is inherit from the UIView, and I want to do the layout in the Hello.xib, and I want to allocate them to the HelloView.m / HelloView.h, how can I do so? Thank you. ...

iOS iPad GUI deadlock on startup. Hung on splash screen.

My iPad app hangs on startup sometimes. It looks like the main thread is getting deadlocked with another thread but not sure why. Any ideas on what's causing this and how to debug this? FYI my app starts as a splitview controller with a listview on the left and a webview on the right. If I start in portrait mode with the list view hidd...

Can somebody help me out with plists?

Hi all, I have a little problem with plists. I don't know how to read data from my plist and in general how to structure it correctly. Here is how it should look like: Root product 1 type 1 string 1 string 2 typ2 2 string 1 string 2 product 2 type 1 string 1 string 2 typ2 2 string 1 string 2 The strings are paths to im...

How to change a new nib when I rotate the device?

I have a helloController which is a UIViewController, if I rotate the device, I want it change it to load a new nib "helloHorizontal.xib", how can I do? thank you. ...

UIButton State (UIControlState)

How do I set the state of of UIButton ? In the UIButton class reference there is a "state" but it is only "readonly". Thanks James ...

My own (new) class not found after xcode update

I'm developing iphone app. Yesterday I updated my xcode to to newest version and clean build folders (deleted it), then created new class (nothing special): @interface EnemyFactory : NSObject { } +(Enemy *)properReferenceForName: (NSString *) name; @end Implementation is trivial and not important. What is happening now: I've got sth ...

didSelectRowAtIndexPath problem

Hi All, I have a problem that I had working in a test but now in a bigger application I can't seem to sort out. First of I have a view that has six button each loads a different view I am using: - (IBAction)showInfo2:(id)sender { InfoViewController *Infocontroller = [[[InfoViewController alloc] initWithNibName:@"InfoView" bundle:nil] ...

How to get back the selectedController from UITabBarController?

I created a UIRotatableTabBarController, which is a subclass of UITabBarController. It is something like this: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations NSLog(@"Autorotation has been detected!"); if (self.selectedIndex == 0) { ...

How to record an audio and play the recorded audio in Iphone sdk?

Hi guys, I need to record an audio and play it in my app.As I am newbie I don't know how to implement it.Can anyone Please suggest me how to do this. Thanks in advance, Monish ...

Can I use protocol objects as keys in an NSDictionary?

I've read in Apples docu that (as I expected) an NSDictionary is not constrained just to strings for keys. There's also a post here confirming that Sets can be used. I want to use protocol objects but it' not happening. I initWithObjectsAndKeys and pass @protocol(MyGreatProtocol) as a key. Compiles but I get a runtime error saying someth...

Non-spaced method definition style

Hi, people. I study Obj-C and Cocoa now, and I was wondering: why everybody writes method definitions/implementations like this: - (void)translateOriginToPoint:(NSPoint)newOrigin{ - all together, no spaces. For me, it's way more clean to write everything with spaced like this: - (void) translateOriginToPoint: (NSPoint) newOrigin { ...

How to get corresponding response of corresponding URLConnection, if we use more than one URLConnection?

Hi, I am not sure how should i get corresponding URLConnection response data , if i use more than one URLConnection. Please help me out, i need to use more than one URLConnection? Regards Sri ...

Get latitude and longitube from city name

I would like to enter the city name in the UISearchBar,then the map will jump to the current city. How to do it? ...

UILabel Over UISlider Thumb...

Hi, How can i put an UILabel over the thumb of UISlider...so that when i move the thumb....UILabel will also move....as it is on the thumb... Any idea?? ...

What is the best method for creating a layer to catch touch events?

I need to put up an info screen above the main interface, but I need it to be alpha'd so you can see the interface underneath it. However, when I touch across the screen, the interface underneath is still running. What is the best method for intercepting the touch events so they don't pass through? I tried to add a custom UIButton the s...

How to make a UIView that can cover the navigation bar?

I want to show the UIView in full screen, but show the status bar, other things, like the navigation bar need to cover by the UIView. How can I do so ? Thank you. ...

Infinite source rectangle to drawImage method

Why do i always get this log, Infinite source rectangle to drawImage method, is this such an error or there's something wrong with the code algorithm. I don't really understand about this, and i can't find any useful information on google. Hope i can find the answer on this site. sorry, this is my drawRect method : - (void)drawRect:(N...