cocoa-touch

UITabBar view

Hi, I had a navigation controller based application. And I decided to use tab bars in my application. When the user presses at a certain tab bar item I want to display a certain view controller - and I want programatically in my code choose which one to display. I tired to add in the Interface Builder a navigation controller into my t...

What are your favourite UITableView / UITableViewCell tricks?

UITableView is a very powerful class, powering many navigation and preference views on iPhone. Many people have come up with useful UITableView tips, tricks and samples: various ways to use Interface Builder for table cells how to create preference-style cells ensuring good scrolling speed etc. Please post your favourite tips on usin...

Is there a difference between an "instance variable" and a "property" in objective-c / cocoa / cocoa-touch?

I'm not very sure about this. I think that an "property" is an instance variable that has accessor methods, but I might think wrong... ...

Initialize NSMutableArray: [NSMutableArray array];

If you initialize an NSMutableArray with NSArray's convenience method as above, do you get an NSArray or an NSMutableArray? Any consequences? (I know that NSMutableArray has "arrayWithCapacity:, I'm just curious) ...

Is there an easy way to iterate over an NSArray backwards?

I've got an NSArray and have to iterate over it in a special case backwards, so that I first look at the last element. It's for performance reasons: If the last one just makes no sense, all previous ones can be ignored. So I'd like to break the loop. But that won't work if I iterate forward from 0 to n. I need to go from n to 0. Maybe th...

[super viewDidLoad] convention

I see some example code with [super viewDidLoad] called before your implementation and after your implementation. I know you don't always have to call super (as seen in many other discussions). When you do call it, is it expected before or after you code? This could have consequences depending on what super's implementation does. Thou...

UIImageView and UIImage: How can I tweak the most performance out of them?

First: I've implement a fairly complex scrolling mechanism for images, that allows to scroll over a few hundred thousands (theoretically) in one single scroll view. This is done by preloading small portions upon scrolling, while re-using all UIImageViews. Currently all I do is to assign new created UIImage objects to those re-used UIImag...

How to handle Objective-C protocols that contain properties?

I've seen usage of Objective-C protocols get used in a fashion such as the following: @protocol MyProtocol <NSObject> @required @property (readonly) NSString *title; @optional - (void) someMethod; @end I've seen this format used instead of writing a concrete superclass that subclasses extend. The question is, if you conform to th...

Creating a custom text-drawing view

Hi, I am creating a syntax highlighter for the iPhone and in order to display text with multiple formats, I have sub-classed UIView and modified the drawRect: method so that each line is displayed with the proper syntax highlighting (highlighting is done earlier with RegEx, text is drawn with CGContextShowTextAtPoint() one line at a tim...

What (not yet existing) iPhone apps do developers wish to get more productive?

What (not yet existing) iPhone apps do developers wish to get more productive? Let's do some brainstorming ;-) ...

NSURLConnection do not launch

Hello experts! I'm trying to create a very simple app which connects to an URL and gets the contents of that URL, in this case a simple xml document. My problem is that that the request never seems to gets sent. I have created a new project(Foundation tool) which runs from a main file. I have set the delegate of the NSURLConnection to...

Regex solution for Objective-C

What is the best method for using Regular Expressions within Objective-C? There seems to be some open source project that provide regex support, can any one recommend one? Also I looked at NSPredicate, can anyone suggest any regex examples? Background: I want use regex mainly for validation, IP's, email addresses, internal ID's etc ...

Core Animation or OpenGL ES?

Hey, I want to do the following: Tap the screen and draw 3 cricles around the the tapped point. Is it better to do this with Core Animation or OpenGL ES? Where do I start? Regards ...

How do I check what current view is?

I want to check what the current view is objective c (in cocoa touch) Could I do something like this? if (viewA == current view) { run code here } Thanks ...

Ia there a way to get or calculate true north in cocoa touch?

Hello I am would like to determine a direction moving x degrees clockwise starting on true north. Is there a way for me get or calculate true north based on a set of lat & long coordinates? I am interested in implementing this cocoa touch. I am sure this is used in many of the applications already out there. Any comments, pointers, adv...

Best practice? iphone: sync data

So i'm working on a project where there is data visualization. My ultimate goal is that i have a set of data shipped with the download of the iphone app. But i want it connected to a backend, that if the iphone has a connection with the internet. it can sync the changes from the backend. The syncing is no problem or the connection betw...

Why do my accelerometers respond so slowly?

I'm asking them at 50Hz / 50 times per second for data. When I suddenly flip the device on the x-axis by 90 degrees while the device was flat on a table with display facing up bevore, the values move pretty slowly to the "target" value for that position. Now the weird thing is: If I increase the measurement-rate, the value will move fas...

iphone FMDB can't find table

- init { if(![super init]) return nil; //the database is stored in the application bundle. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingFormat:@"/base.sql...

Photos app-like gap between pages in UIScrollView with pagingEnabled

UIScrollView in paging mode assumes the pages are located right next to each other, with no gap. However if you open a photo in the Photos app and swipe through photos, you can see that it has some gap between pages. I want these gaps too. I'm looking for existing solutions if any, or for some more bizarre ideas about implementing the p...

How to limit UITableView row reordering to a section

I was hitting my head over this one, and google was turning up nothing. I eventually worked it out and thought I'd write it up here for the sake of the next person. You have a UITableView with multiple sections. Each section is homogeneous, but the table overall is heterogeneous. So you might want to allow re-ordering of rows within a s...