iphone

Using an Objective-C++ file from a C++ file

Hi. I have a c++ app that I'm trying to port to iPhone and to start off I'm trying to replace my c++ texture loader with an obj-c++ texture loader so that I can make use of the cocoa libraries. A lot of my c++ files (.cpp files) call the texture loader with something like: GLuint mTexture = TextureLoader::LoadTexture("file.png") //Load...

When parsing with NSXMLParser, does it download the whole .xml then parse, or does it do a streaming parse?

Programming for iPhone. Title says it all. When parsing with NSXMLParser, does it download the whole .xml then parse, or does it do a "streaming" parse? Essentially if I abort the parse halfway through, do I save bandwidth, or just cpu cycles? ...

iPhone App Crashing due to UITableviewControllers

For Screenshot please go to - http://img188.imageshack.us/img188/2097/screenshotrhm.jpg I have 2 UITableViewControllers and 2 UIViewControllers containing the 2 UITableViews and they all are contained in a single UIViewController from where all the interaction happens..I load the UIViewControllers of the UITableViews on a button click ...

Custom Uisegmentedcontrol

How do I make a custom UISegmentedcontrol. I have 2 images, 1 that should be displayed when the segment is active and the other if the segment is inactive. Can i override the style or something so i have a UIsegmentedcontrol with my own images as active/inactive background? ...

Do constants always keep the same value?

I've been reading that when conforming to the NSCoding protocol and implementing the methods like -encodeWithCoder:, and encoding objects with i.e. [coder encodeObject:self.someObject forKey:kSomeConstantToIdentifyFields]; this constant is used to keep track of that object. So later, with help of that constant, the appropriate "field...

How to Identify tab bar items?

Hello, I would like to know how can I identify the items in the tab bar? I have a tabBarController that contain NAvigationController like this: NSMutableArray *localViewControllersArray = [[NSMutableArray alloc] initWithCapacity:6]; Each navigationController is inside this array. I manage the actions in each tab bar item with the ...

becomeFirstResponder seems to work only 1st time for shake gesture

I'm making my app shake-gesture-compatible by doing this in my UIViewController: - (void)viewWillAppear:(BOOL)animated { [self.view becomeFirstResponder]; [super viewWillAppear:animated]; } The problem is that when I flip to another view (I'm using the "Utility App" template which has a flipside view and a root view controller...

Iphone UITableView move Index with prefilled values

Hi Guys, I'm trying to enable my UITableView for being able to change the Index of values. Means that I have currently 6 values within an NSMutableArray which actually fills the UITableView. The user is already able to change the position of the Entries of the UITableView/MSMutableArray. As long as the application runs, the index cha...

Is hard-coded subview sizing brittle or best practice?

Coming from a web background, where explicit sizing is generally not considered best practice, I am not used to 'hardcoding' positioning values. For example, is it perfectly acceptable to create custom UITableViewCells with hardcoded values for subviews' frames and bounds? It seems that when the user rotates the device, I'd need another...

Autorotation of CALayer on iPhone rotation

I have a UIViewController where I am adding a CALayer subclass to the view's layer: [self.view.layer addSublayer:myObject.backgroundLayer]; When I rotate the device, the view rotates, but the CALayer doesn't. It sort of gets shunted off to the left, still in portrait view. Is there a way to make sublayers rotate automatically or do ...

App simulates perfectly in SDK 2.2.1 but collapses when i run it in Simulator 3.0

Hi , I started building an app in SDK 2.2.1 and i have now completed it . Now when i try to run it in simulator 3.0 it collapses at runtime and i get the following message in gdb "Loading program into debugger… GNU gdb 6.3.50-20050815 (Apple version gdb-965) (Mon Feb 16 20:24:53 UTC 2009) Copyright 2004 Free Software Foundation, Inc. G...

iPhone Exception Handling

I have one crash in my iPhone application that does throw an NSException. The crash reports are completely ambiguous in where the error is and what exactly is causing it. Is there a smart way for me to set a top level exception handler somewhere to see what is causing it? I can't replicate the problem myself, but a few of my beta users c...

What's the difference between KERN_INVALID_ADDRESS and KERN_PROTECTION_FAILURE?

What's the difference between KERN_INVALID_ADDRESS and KERN_PROTECTION_FAILURE on iPhone OS? I have two crash reports from an ad-hoc beta tester that are 5 minutes apart and the main difference between them (other than the "Binary Images:" section) is this section: Report A: Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: KE...

I get error 0x8badf00d in iPhone app, and is not the usual suspect

I have a random crash in my app in launching. I'm pretty sure is not the launching time (as explained in http://stackoverflow.com/questions/773442/what-does-8badf00d-mean/779387) because the app launch fast. The worst is that the crash log can't be simbolicate (I can't get the sourcecode line numbers). This is the error: Exception Typ...

Double-tap or two single-taps?

What is the time limit for two taps to be considered a double-tap, on the iPhone OS? // Edit: Why is this important? In order to handle single-tap and double-tap differently, Apple's guide says to do performSelector...afterDelay with some 'reasonable' interval on first tap (and cancel it later if the second tap is detected). The probl...

KVO rocks. Now how do I use it asynchronously?

I am sold on KVO but if used in the obvious way it is synchronous. I would like to use it in a situation where I am firing off many KVO messages in rapid succession and it is causing my app to grind to a halt as the KVO messages are handled. Can someone suggest an approach - perhaps using NSOperation or NSThread - that will work here. M...

UIImagePickerController, UIImage, Memory and More!

I've noticed that there are many questions about how to handle UIImage objects, especially in conjunction with UIImagePickerController and then displaying it in a view (usually a UIImageView). Here is a collection of common questions and their answers. Feel free to edit and add your own. I obviously learnt all this information from some...

iphone string manipulation

I have the following string.... Overall: 21 (1,192,742<img src="/images/image/move_up.gif" title="+7195865" alt="Up" />)<br /> August: 21 (1,192,742<img src="/images/image/move_up.gif" title="+722865" alt="Up" />)<br /> I need to remove the HTML tag, is there a way I can say remove everything between ??? ...

Where's the difference between [MyClass alloc] and [[self class] alloc]?

Is there a good reason why I should not do something like this? Example: I have a class MyClass. In there I have this implementation: - (id)copyWithZone:(NSZone*)zone { MyClass *copy = [[MyClass allocWithZone:zone] init]; copy.someproperty = [[self.someproperty copy] autorelease]; return copy; } Instead of that, I found a...

OO Objective-C design with XML parsing

Hi, I need to parse an XML record that represents a QuizQuestion. The "type" attribute tells the type of question. I then need to create an appropriate subclass of QuizQuestion based on the question type. The following code works ([auto]release statements omitted for clarity): QuizQuestion *question = [[QuizQuestion alloc] initWithXMLS...