cocoa-touch

Two questions regarding this iPhone UI

I'm taking a look at some basic UI principles that the mint.com team put into the iPhone application. A quick screenshot that I'm referencing is here: http://tinyurl.com/dm5j9d I have two questions regarding this UI: 1) There is an elegant space between the UITableViewCell's in which you can see the mint green background of the UITable...

Extending UIScrollView and Monitoring Scroll Events

I'm wanting to implement some custom, reusable and efficient scroll behavior in an iPhone app so I'm extending UIScrollView with my custom control and wish to track scroll movements. Now I'm aware that I could probably assign my custom control as a UIScrollViewDelegate and internally respond to scrollViewDidScroll calls but this doesn't...

Property vs. instance variable

Hi all, I'm trying to understand how strategies some folks use to distinguish instance vars vs. properties. A common pattern is the following: @interface MyClass : NSObject { NSString *_myVar; } @property (nonatomic, retain) NSString *myVar; @end @implementation MyClass @synthesize myVar = _myVar; Now, I thought the entire prem...

Problem with initiating UITableViewCells based on indexPath.row

I have the following method that should populate the cells of my UITableView with data from an array. I want to get the data from the array using the row that the data is being loaded into as the index. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { cellComments=(FullCommentC...

NSRunloops and forcing event processing...

I have a few tabs in my iPhone application which take a few seconds to load (pulling large amounts of data from a local sqlite database). When the users touch the tabs it appears as if the application is doing absolutely nothing. I've attempted to put a window showing a spinner up, however it is never shown due to the fact that the pro...

UITableView cells loading correctly initially but then changing

The following method loads data from an array into custom cells of UITableView. The data is loaded in correctly. However, when I scroll down data in the above cells (the cells not visible) are changed to seemingly random elements in the array. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *...

Objective-C: Why am I getting a compile error when importing a header file?

I'm curious what some reasons might be as to getting a compiler error for simply importing a header file. If I comment it out, everything compiles just fine -- the header/implementation for the class I'm trying to import into one of my UIViewController's get passed the compiler without any warnings. However, as soon as I include it, I ge...

UIImagePickerController editing allowed locks UIImage to max size of 320x320

Update: With iPhone OS 3.0+, the whole UIImagePickerController API has changed. This question and answer should be considered 2.2. legacy code. When using the UIImagePickerController and you allow editing of the image. The iPhone allows the user to resize and pan the image. However, the max size of an edited image is capped at 320x...

URL for the Artist page or search page of App Store?

I am creating an iPhone game. I want to have a button in my game that takes people to the other games by me. I get the URL from the iTunes (copy URL) like this: http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewArtist?id=307450671 But when I open this URL in iphone, it take me to the iTunes, not App Store. and I also tried http://p...

iPhone: Change custom button graphic

I need to programmically change the graphic for a custom button and I'm puzzled why the code below isn't working. I can uncomment the first line and hide the button, so the IBOutlet is connected. The variable cardString points to a valid image (0-51.jpg). //[c1 setHidden: YES]; cardString = [NSString stringWithFormat:@"%d%s", ca...

UITableView - scroll to the top

Hi, In my table view I have to scroll to the top. But I cannot guarantee that the first object is going to be section 0, row 0. May be that my table view will start from section number 5. So I get an exception, when I call: [mainTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewSc...

NSInvalidArgumentException

I'm getting a crash from this routine after adding the :(id)sender so I could determine which button called it. When set up as plain old toggleView3 it works perfectly. The crash occurs when detailView is toggled back to docView. 'NSInvalidArgumentException', reason: '*** -[RootViewController toggleView3]: unrecognized selector sent to ...

Why is Instruments reporting this as a memory leak?

I have some code that looks like the following: NSMutableArray *bar = [[NSMutableArray alloc] initWithCapacity:0]; NSMutableDictionary *foo = [[NSMutableDictionary alloc] initWithCapacity:0]; [foo setObject:[NSNull null] forKey:@"yay"]; [bar addObject:foo]; [foo release]; Instruments is showing that foo is leaking. I understand why t...

Change navbar title programatically

I'm working with the Xcode Utility template. In rootViewController.m there's a section that sets up the navbar for what's called the FlipSideView: (snip) UINavigationItem *navigationItem = [[UINavigationItem alloc] initWithTitle:@"Title"]; (snip) How can you programatically change the navbar title from within the FlipsideViewControl...

UILabel - how to change text position

Hi, I am trying to add subviews to my UITableView cells. It works just perfect for me, but the text appears at the very left edge of a cell. How can I move it a little bit to the right side? I want to have a little margin from the left cell border. Thank you in advance. ...

Clearing all text fields in xcode

Is there a way of clearing all test fields when selecting a text field to enter text with the keyboard. For instance if you had a tip calculator that you have already run once, and all the fields are now populated. Now when you want to run another calculation, you click on the text field an all the other fields are automatically cleare...

iPhone - Why did all interface went a little bit down

Hi, I changed something in my cocoa-touch application and all interface went down for something like 20 pixels. And at one view there is a white bar at the top (it has no background color, although view itself has one). And in the interface builder nothing changed - everything looks as it should look. Anyone has an idea why could this h...

How do I encode "&" in a URL in an HTML attribute value?

I'd like to make a URL click able in the email app. The problem is that a parameterized URL breaks this because of "&" in the URL. The body variable below is the problem line. Both versions of "body" are incorrect. Once the email app opens, text stops at "...link:". What is needed to encode the ampersand? NSString *subject = @"This...

iPhone: Testing application on iphone through Windows

I have participated in the iPhone Developer Program. I can debug my application through Mac over the iPhone. For some reasons I need to be able to test the same application on another iPhone using Windows. Is there a way to achieve this? How do I deploy the application from Windows? Any pointers will be highly appreciated. ...

Memory leak involving NSString

Hi, I can't find a cause for a memory leak in my application. I found out that there is a memory leak through instruments and than more times I call the function than more memory leaks occurs. So it is obvious that a memory leak takes place. Here is my code. Object: @interface WordObject : NSObject { int word_id; NSString *word...