objective-c

Figure out UIBarButtonItem frame in window?

Hey guys, UIBarButtonItem does not extend UIView, so there is nothing like a frame property. But is there any way I can get what is it's CGRect frame, relative to the application UIWindow? ...

Set a grouped UITableView to start at a given section?

I have a grouped UITableView that has basic data inside it, but I would like to start the UITableView at a certain section when the app loads, can this be achieved? Thanks Mark ...

My UITableView has duplicated rows

Im not sure why, but my UITableView, which isnt anything fancy, is showing repeating rows when it shouldnt be. It seems that the rows that get added when the user scrolls (i.e. the rows that are off the screen to start with) are getting the data for the wrong row index. Its almost like when a new cell is de-queued, it's using a cell th...

How to manually throw a compiler error in GCC and Xcode

In xcode, while compiling apps with gcc, I want to throw compilation time errors if things like NSZombieEnabled is on for a distribution release, thus ensuring that compilation will fail and I won't accidentally do something stupid. I did some googling, but could not figure out how to cause the compiler to bail if a certain condition is...

Unload image of UIImageView thats offscreen

Hi, I'm coding an application on Ipad, in a certain point of my application I present a ViewController with the presentModalViewController. My ViewController is a UISScrollView who take the larger of the modalView and inside it I display some images, I allow pagingEnabled so I can see all my images inside the scrollView. Sometimes I ...

XCode Syntax Coloring Broken

XCode frequently seems to lose it's mind, and doesn't color code system classes or provide correct "code sense" suggestions. This is endlessly frustrating. The question has been asked on at least three other occasions: http://stackoverflow.com/questions/2263994/problems-with-xcode-syntax-highlighting http://stackoverflow.com/questions/...

Objective C Class help?

I get this error, and I dont get how to fix it? class 'SoundTap_HDViewController' does not implement the 'AVAudioPlayerDelegate' protocol Any help? ...

How should I load a xib into a detail view for a split view iPad objective app?

I've got a split view iPad app with table view in the master pane. After drilling down several levels, each time loading a new .xib, I'd like one of the cells to trigger a web page load in the detail pane. Right now I can only get the web page .xib to load in the master pane side -- which is a master pain in my side. The basic load cal...

UIColor app crashing

i have a global variable UIColor *textColor; I am update this variable by the code textColor = [UIColor colorWithRed:fr green:fg blue:fb alpha:1.0]; then assigning this color to Label like this myLabel.textColor = textColor; It only work once, when i again call with updated values and assign label new values app crashes......

iPhone 4.0 Screen Resolution and writing robust code...

Does anyone know what will happen with existing apps when they run on the iPhone 4.0 in terms of the new screen resolution? I am assuming, just like developing for the iPad that there should be no hard coded screen resolutions in your code. I'd also like advice on the best way of writing robust code to work well on any device. For ins...

what should i write in the info.plist to open pdf file in my app from pdf page in ipad

i want to open the pdf file in my app from the pdf file, this my info.plist file. <key>UIFileSharingEnabled</key> <true/> <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeName</key> <string>pdf</string> <key>CFBundleTypeExtensions</key> <array> <string>pdf</string...

Efficient method of getting all plist arrays into one array?

If I have a plist which is structured like this: Root Array Item 0 Dictionary City String New York People Array Item 0 String Steve Item 1 String Paul Item 2 String Fabio Item 3 String David Item 4 String Penny ...

How to set from email manually in MFMailcomposer in Iphone sdk?

Hi guys, Here I need to set From email: in MFMailcomposer by an default email address.Can any one suggest how to set the from email manually. Anyone's help will be much appreciated. Thank you, Monish. ...

Running cocos2d with iPhone SDK 4 GM

I tried to build my (cocos2d 0.99.0-based) project with iPhone SDK 4 GM which was just released today. The reason is because I want to incorporate iAds in my apps. However I got 20 error messages which looks like errors in library calling. Can anyone tell me whether we can actually use cocos2d 0.99.0? I'm aware that 99.3 was released but...

Casting an NSString* to char?

How can I cast a NSString* into a char? EDIT: Thanks to Vladimir for getting me there! NSString *myString = @"HelloWorld"; const char *stringAsChar = [myString cStringUsingEncoding:[NSString defaultCStringEncoding]]; Hope this helps someone in the future! ...

NSMutableArray Vs Stack

I am developing 2D game for iphone in Objectice-C.In this project I need to use stack, I can do it using STL(Standard template library) stacks or NSMutableArray, since this stack is widely used in the game which one is more efficient in terms of runtime speed and memory use? @interface CarElement : NSObject { std::stack<myElement*> *m...

Movieplayer doenst rotate anymore when I used setControlStyleNone

I added this to my code when im initializing the movie [m_pMPmpc.moviePlayer setControlStyle:MPMovieControlStyleNone]; where m_pMPmpc is an MPMoviePlayerViewController It worked fine but then I noticed that the movie doesnt rotate anymore while playing(but the app after the movie still rotates) but it detects the orientation at the st...

iPad full screen (1024x768) animation with around 1800 frames problem. Low FPS

What I am trying to do is to play a full screen (1024x768) animation on iPad with an around 20 fps. I have got a scene with 1800 full screen frames. Until now I have tried a lot of approaches but have encountered a lot of problems. My first approach was to get the texture using the following function t = [[CCTexture2D alloc] initWithIm...

iphone simulator always needs clean and build!!

I always need to Build > Clean and Build and Run in order to check my new updated code. If i dose not clean first the simulator does not show the updated code. How to correct this behavior? ...

When is [NSWindowDelegate windowWillClose] called?

I have observed that windowWillClose is called when the user closes a window but is NOT called when the window is closed because of app termination. Now, for me this is a good thing because I want a certain piece of code to run when the window is closed but not at shutdown. The reason for the question is that I cannot see why this shou...