iphone

How does Fast Enumeration (looping) work in Objective-C? (ie: for (NSString *aString in aDictionary)...)

I'm working on implementing a customized searchBar for a fairly complex table and have come across this code pattern AGAIN. This is a sample from the Beginning iPhone Development book: - (void)handleSearchForTerm:(NSString *)searchTerm { NSMutableArray *sectionsToRemove = [[NSMutableArray alloc] init]; [self resetSearch]; for (NSStrin...

iPhone toggle button implementation

Hi, I would like to create a toggle button in my iPhone application. However, I don't know exactly what would be the best approach for this. I am considering two options. I could subclass an UIButton. That way I do not have to implement touch handling. I could just create a method that returns a boolean indicating whether the button i...

reposition or resize tableView in tableViewController?

I have a ViewController consists of a ImageView on top at (0, 0, 320, 100). I need to have a tableViewController below it, say from (0, 100, 320, 380). This is how to do it. It works but the problem is when i click a row on the table, I need to push anotherViewController. But there is no way to get back to the "parent" controller (there ...

Performance problems reading in iPhone ABAddressBook

I am creating a lookup table mapping contact phone numbers to their corresponding ABRecordRef (I need this so I can efficiently look up contact names and photos based on the phone number a user has dialed). Unfortunately, for 500 contacts it takes around 4 seconds to loop through all the contacts and create my lookup table, which makes ...

How to add an imageView on top of a tableViewController?

I have a ViewController consists of a ImageView on top at (0, 0, 320, 100). I need to have a tableViewController below it, say from (0, 100, 320, 380). How do I do that? please help I tried many methods but it didn't work out. I need your help. ...

Error on CLLocation subclassing

I'm trying to make a new CLLocation subclass. This is the skeleton: #import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> @interface JFLocation : CLLocation { } @end #import "JFLocation.h" @implementation JFLocation @end When I build the class I'm getting this errors: Undefined symbols: ".objc_class_name_CLLocation"...

On Cancel Pressed of UISearchBar - Fire Custom Action in iPhone

As given in the picture, I have an search bar in my application. Now I want to handle my custom action on Cancel Taped. -> On Cancel Taped -> PopViewController -> On Cancel Taped -> Clear Search Text & Hide Search Bar Keyboard. I don't know how to handle Cancel Tap? Thanks in advance for helping me. ...

My iPhone Simulator Crashes Everyother Time I Run it

The app will run fine, then crash - literally every other time. It seems like the crash cleans up the memory and clean run corrupts the memory. I assume it has to do with memory allocation but I am not sure. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyI...

deselectRowAtIndexPath on an ABPeoplePickerNavigationController

I'm showing an ABPeoplePickerNavigationController as a tab in my app. The user clicks a name, then email address, then I do something with the email address. Afterwards, I'd like for the person and property that they selected to fade out (not be highlighted). In a normal table, I'd call deselectRowAtIndexPath. But with the ABPeoplePi...

After tabBar setHidden, the controller's view won't stretch full screen.

In fact, the screen area where the tab bar was before, now is not accessible. If I add something on to that area, it just got cropped. I tried setFrame to 320x480 but it won't help please help ...

Cocoa - Singleton object: Where to initialize member variables?

Hello people! I was wondering where is the best place to initialize members of the singleton class. I'm using Apple fundamental guide singleton implementation. Could you please pinpoint at what line the inits happen? The code is the following: static MyGizmoClass *sharedGizmoManager = nil; + (MyGizmoClass*)sharedManager { @synchr...

Check if drawn path/CGPath intersects itself in an iPhone game

I have a path drawn in OpenGL ES. I can convert it to a CGPath if needed. How would I check if it intersects itself (If the user created a complete loop)? ...

Rotate UIButtonTypeDetailDisclosure

Is there any way to rotate a disclosure button? I'd like it to point down if a row is selected. ...

Getting an XML file from URL to NSData object ?

Hello, I need to load a .xml file from a URL adress into an NSData object for further parsing with some libraries that I already own, ( but they ask me the .xml file as NSData ), how could I do this ? The url format would be something like this: http://127.0.0.1/config.xml ...

how can we rotate the texture drawn for a image in the open gl project using objective c ?

HI alll i am drawing the image on an opengl view using [Texture2D_plane drawAtPoint:CGPointMake(_position.x,_position.y)]; but after at certain point i want to make the rotation of the texture what function i have to use for it . from somewhere i use glRotatef(90,_position.x,_position.y,0); but i don know how to use it i just wa...

Can't refresh iphone sqlite3 database

I've created an sqlite3 database from the command line and inserted several records. My app retrieves all of them and shows them just fine. I then go back and insert a few more records via the sqlite3 cli, erase the db file out of the simulator's documents directory so that it will be recopied from the main bundle, and the run the app ...

Adding to UITableView

I am working on an iPhone app, but i need to be able to add things to a UITableView... What is the easiest way to do this? Techy ...

How can I edit Shark configurations on the iPhone?

The default shark 'Time Profile' configuration on the iPhone appears to sample every 1 ms. I'd like to tweak it to sample every 100us. I know this is possible to do on my local machine by editing the shark configurations, but I don't see a way to edit the configurations on the phone. Thank you, ...

Objective-C/iPhone memory management question

In my iPhone app, I have a "statistics" view that is displayed by the following method - the method itself is called when the user touches a button. This method is in a UINavigationController - (void) showStatsView { StatsViewController *statsViewController = [[StatsViewController alloc] initWithNibName:@"Stats" bundle:[NSBundle mai...

When do I not need to specify File's Owner for a nib?

I have been reading up on File's Owner here on Stack Overflow and a few other resources, but I was left with one question. When do I not need a File's Owner for a nib? In chapter 8 of Exploring the iPhone SDK (a great book by the way) you design a table view cell nib. The author says the following: You might be wondering why we're not d...