iphone

Adding subviews to UiScrollView .. smoothly

I am trying to dynamically add subviews to a UiScorllView in real time (to save memory). Doing so causes the scrollview to hang for a brief second... what is the way around this? any hints appreciated ...

Cost of message dispatch in Objective-C

I'm curious to know about the cost of message dispatch in Objective-C in various situations. Particularly I want to guide my choice of program design so I'm not tempted to prematurely optimize by avoiding message dispatches when they would make for a better design. A case in my current project is that I have a class with instance variab...

"Changing the delegate of a tab bar" exception

Hi, I have an application that perfectly works on iPhone os 2.2.1 but when I try to run it on iPhone os 3.0 it crushes. Here is the error I got from the console: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Changing the delegate of a tab bar managed by a tab bar controller is not allowed.' Pr...

Using the value of a string to determine the instance of a class

I have a switch statement similar to this one: switch (number) { case 1: if (imageView1.hidden == NO) { imageView1.hidden = YES; } else { imageView1.hidden = NO; } break; case 2: if (imageView2.hidden == NO) { imageView2.hidden = YES; } else { imageView2.hidden = NO; ...

playing background audio on iphone

Hello, How can I play a background audio while my application is running? Thanks. ...

Launching Instruments from Xcode on iPhone project with libxml2 fails

I get a crash whenever launching an iPhone application that uses libxml2 in Instruments from Xcode. Ideas as to the cause? Ultimately this reason is given: Reason: Incompatible library version: Foundation requires version 10.0.0 or later, but libxml2.2.dylib provides version 9.0.0 ...

How to keep controllers out of xib

As a newbie, IB and all the possible connections is bewildering to me. Most tutorials I've found are what I'd call the reincarnation of spaghetti code, in which the entanglement is all the connections created by dragging. Of course, I want to use IB for layout of views (sizing & placing visual elements), that's what IB is great for. B...

Problem in including AVAudioPlayer

Hi, I am trying to use this class as AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: fileURL error: nil]; and getting this compiler error "error: AVAudioPlayer.h no such file or directory" I have added "#import "AVAudioPlayer.h" at the beginning of the .m file Could you let me know how can ...

AVAudioPlayer stops playing the audio when iPhone goes to sleep

Hi All, I need to play a background sound all the time as long as my application is running. I tried to use AVAudioPlayer for this purpose. However, it stops playing the sound as soon as the iPhone goes to sleep mode. Could you let me know how can I fix this problem? Thanks ...

UIWebView - How to identify the "last" webViewDidFinishLoad message?

The webViewDidFinishLoad message seems to be sent each time any object in the page has been loaded. Is there a way to determine that all loading of content is done? ...

iphone maps help needed ...

Hi all, I need you help. I saw one application myhomes for iphones. link for that app is from myhomes.com. they are using map in which markers are there when you click on marker one button is displayed(that is really a thaught for me how to disply a button in objective c when we click on marker in webview because there we might using jav...

CoreData equivalent of sum...group by

I have the following pseudo-SQL schema: table flight id int primary key date timestamp aircraft_id int (foreign key to aircraft.id) table flight_component flight_id int (foreign key to flight.id) component_id int (foreign key to component.id) duration double If I convert this to using CoreData, is there an equivalent way ...

NSArray from URL encoding problem

So I have the following code: NSURL *baseURL = [NSURL URLWithString:@"http://www.baseurltoanxmlpage.com"]; NSURL *url = [NSURL URLWithString: @"page.php" relativeToURL:baseURL]; NSArray *array = [NSArray arrayWithContentsOfURL:url]; If the XML page is as follows: <array><dict><key>City</key><string>Montreal</string></dict></array> ...

multiline uibutton

how to set a multiline as title of a UIButton in iPhone programming pls help me .. thanks and regards .. ...

How to exit NSThread

Iam using a thread like this, [NSThread detachNewThreadSelector:@selector(myfunction) toTarget:self withObject the thread is running correctly,i want to quit the thread in the middle,how can i do this.If i use [NSThread exit] the application is hanging. ...

What does it mean to call initWithFrame on a UIView class or subclass with CGRectZero?

I have seen code that calls initWithFrame of a UIView subclass (such as UILabel) with CGRectZero and things seem to work fine. What does it mean to instantiate a UIView subclass with a 2D point (which seems to be what CGRectZero is)? ...

how to calculate immediately as soon as typing in uitextfield in iphone?

i have a view and i want functionality something like this.. first UITextfield is price for ex- 10000 second UItextField precentage for ex-70 third UIlabel which will show the result for ex- $ 7,000.00 i want this and also as soon as i type 7 the result label should show $ 700.00 ...

Writing clean, performant code for the iPhone

I have been developing on the iPhone with Objective-C for a few months now and I have been applying the best-practices learnt and refined while developing applications with Java. These include: designing classes that have a single responsibility, application of design patterns where appropriate, and writing short methods that do one thin...

Adjusting interface when keyboard appears for UITextField in a simple UIVIew without scroll view?

is there any way to move some textfield in a simple UIView up so that they could not be hide behind the keyboard.? is it possible without using UIScrollView ...

iphone memory management

I have a method that returns a NSMutableArray: //implementation of class Students -(NSMutableArray *)listOfStudents { NSMutableArray *students = [[NSMutableArray alloc] init]; //add objects to students and other operations here return students; } The problem here is, when and where do I release the object students? If it was an...