objective-c

Core Data fetchedresultscontroller question : what is "sections" for?

Hi, I'm trying to get to know Core Data (I'm a noob at iPhone development) and in order to do this I'm trying to get an object from the fetchedresultscontroller and NSlog it's name (a property of the object). I tried to do it like this: NSArray *ar = [NSArray arrayWithArray:[fetchedResultsController sections]]; Task *t = [ar objectAtInd...

Object allocation and memory warning

i have an application which takes "live bytes" up to 3mb. The application showing memory warnings and it will crash continously. when i use object allocation tool i can see the live bytes.im using imageWithContentsOfFile in many places. i can see NSConcreteData object is taking more momory.what is the reson for that? may i know how much ...

How to use single instance of AVAudioPlayers for playing multiple songs?

I want to play multiple songs with single object of AVAudioplayer, I put songs List in scrollview, when user tap on list player view is open but when user go back for other song player play both songs simanteniosly . what I Can do to fix this? ...

UITableView superClass for delegate?

A quick question, I am setting a delegate for UITableView and I have a question regarding setting the delegate and dataSource properties. I have noticed that the properties for delegate and dataSource are not available, I was thinking that adopting the protocols would make them available. But I am now thinking that I maybe have the supe...

Difference between release and release then set to nil.

What is the difference between two snippets? [myObj release]; and [myObj release]; myObj = nil; ...

Init array with bool values

my attempt to init an array with a number of bool values using: [myArray initWithObjects:[NSNumber numberWithBool:YES], [NSNumber numberWithBool:YES], [NSNumber numberWithBool:YES], nil]; seems to fail since the debugger shows an empty array after this statem...

Add UITabBar Control!

hi, I m stuck in a really simple problem. And i m afraid my question might annoy some people. The problem i am facing in short is that i want to add UITabBar Control to my iphone application other than the main screen. Let me explain, I have done everything successfully Added UItabbar control from IB in the main window's xib, added a ...

Is there any easy way to replace one data in plist?

Here is how I can get the value: NSString *path = [[NSBundle mainBundle] pathForResource:@"myPlist" ofType:@"plist"]; NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path]; NSArray *tempArray = [dict valueForKey:@"2"]; NSString *myTarget = [tempArray objectAtIndex:0]; the "myTarget" is something I want to replace wi...

UITabBar with UINavigationController in code

Hi Everyone, I've currently got a UITabBar with 5 screens calling UIViews. That part works fine but I want to put in a UINavigationController in a couple of them. I have found a few tutorials that work fine but all of them implement it in IB and I want to avoid that if possible. I'm lost as to where to implement the UINavigationContro...

objective-c : @synchronized how it works ?

Hi, i have two methods -(void) a { @synchronized(self) { // critical section 1 } } -(void) b { @synchronized(self) { // critical section 2 } } now my question is if a thread is in critical section 1. will the critical section 2 be locked for other threads or other threads can access critical section 2. ...

priority vise All methods of a (xib,.m) file

Hello, I am beginner in iPhone.I want to know what is the priority of execution of all methods like(viewdidload,viewwillappear,viewdidunload and other remaining...). Please tell me anyone what is actual flow of the execution in iphone application. ...

IPhone OS 4.0 - Beta 3 - setContentURL on MPMoviePlayerViewController crashing the App

Hi Everyone. I had this issue, with the beta2 and I thought the beta3 was going to solve it, but I'm starting to think that I'm doing something wrong. I have a MPMoviePlayerViewController playing a video and when the video ends I'm trying to change the video for another like this: [moviePlayerViewController.moviePlayer setContentURL:ne...

Objective C display money format like Sensible Soccer

I'm wanting to display money like SWOS (or Sensible World of Soccer) used to. IE: Instead of: $10,000,000+ you got $10m, 10.5m, etc. Instead of: $1,000,000 you got $1m Instead of: $1,500,000 you got $1.5m It also worked for both large and smaller figures, say; 1k, 1.25k, 0.75k, 0.25k, etc. I'm wondering...

How to linebreak long string constructs ?

I am editing SQLite SQL statements of substantial length. How can I break these into several lines to allow comfortablt editing? const char *sql = "SELECT arguments arguments arguments arguments arguments arguments arguments arguments arguments arguments FROM a, b, WHERE condition condition condition condition condition condition condi...

Function pointers in Objective-C

I have the following scenario: Class_A - method_U - method_V - method_X - method_Y Class_B - method_M - method_N HttpClass - startRequest - didReceiveResponse // is a callback Now I want to realize these three flows (actually there are many more, but these are enough to demonstrate my question): Class_A :: method_X ...

How to concatenate a CHAR

really basic question, I have a string to generate as SQL statement that I need to run through a loop to add all the relevant criteria. How do I concatenate the statement. ...

stringByAppendingFormat not working

I have an NSString and fail to apply the following statement: NSString *myString = @"some text"; [myString stringByAppendingFormat:@"some text = %d", 3]; no log or error, the string just doesn't get changed. I already tried with NSString (as documented) and NSMutableString. any clues most welcome. ...

Objective C: Initalizing static variable with static method call

The Compiler claims an error saying: "initializer element is not constant", when I try to initialize a static variable inside a method with a call to a static method (with + in its definition). Anyway I can tell him that this method always returns the same value. I know this is not the same as static method, but there seems to be no cons...

My program is spending most of its time in objc_msgSend. Does that mean that Objective-C has bad performance?

Hello Stackoverflow. I have written an application that has a number of custom views and generally draws a lot of lines and bitmaps. Since performance is somewhat critical for the application, I spent a good amount of time optimizing draw performance. Now, activity monitor tells me that my application is usually using about 12% CPU and...

Randomize object position

hey everyone, I'm making a little quiz-style application but I've got a few issues. I random the questions from a NSMutableArray using arc4random(), then I populate the view with 3 buttons, one which includes a correct answer and the other 2 include two wrong answers what I need to do is to randomize the X coordinate (position) of the...