objective-c

How to detect the active iTunes store on the iPhone/iPod Touch/iPad?

I'd like to be able to determine which store the user connects to from inside my app, so that I can direct them to some appropriate content for their device AND store. Does anyone know how to get this information? Basically, if the user is in the UK, and connects to the UK store, I want my function/method to return GB, if in Korea, I w...

How to tell when back button is pressed in a UINavigationControllerStack

Is it possible to check when the back button is pressed in a UINavigationController stack? I've tried adding a action and target to self.navigationItem.backBarButtonItem to no avail. Anyone have any solutions? ...

Selection Highlight in NSCollectionView

On some occasions my head just hurts from banging it against the Cocoa wall. Today is one of those days. I have a working NSCollectionView with one minor, but critical, exception. Getting and highlighting the selected item within the collection. I've had all this working prior to Snow Leopard, but something appears to have changed and ...

Advance way of using UIView convertRect method to detect CGRectIntersectsRect multiple times

I recently asked a question regarding collision detection within subviews, with a perfect answer. I've come to the last point in implementing the collision on my application but I've come across a new issue. Using convertRect was fine getting the CGRect from the subView. I needed it to be a little more complex as it wasn't exactly rec...

How do I use the gravity vector to correctly transform scene for augmented reality?

I'm trying figure out how to get an OpenGL specified object to be displayed correctly according to the device orientation (ie. according to the gravity vector from the accelerometer, and heading from compass). The GLGravity sample project has an example which is almost like this (despite ignoring heading), but it has some glitches. For ...

Setting a UITableViewCell accessory type on some cells, but not all

I have 8 cells that are being built in my UITableViewController. I would like to know how I can show a disclosure indicator on the 4th and 8th cells. Right now I am building it in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath though I am fully aware it is going to add a disclos...

Objective-C convention to prevent "local declaration hides instance variable" warning

I am using the following code ... -(id) initWithVariableName:(NSString*)variableName withComparisonValue:(NSString*)comparisonValue { // super init self = [super init]; if (!self) return nil; // set instance variables self.mustExist = NO; self.reverseCondition = NO; self.regularExpression = NO; self.var...

iPhone -- init method of an abstract class

I want to create classes Car, Vehicle, and Airplane with the following properties: Car and Airplane are both subclasses of Vehicle. Car and Airplane both have an initWithString method. The acceptable input strings for Car's and Airplane's initWithString methods do not overlap. Vehicle is "almost abstract", in the sense that any initial...

MFMailComposeViewController programmatically call the "Send" button

Hi, I am trying to send an automatic email with an UIImage as an attachment when user presses 'Send Photo' button. Is there any way that we can programmatically call the "Send" button in the MFMailComposeViewController. If not could you please suggest me some other method of doing this. Any help will be appreciated. Thanx in advance. ...

How to popup a view from bottom?

When click a button,I want to popup a view form bottom,like this! Any help is welcome,thanks. ...

Objective-C: how to prevent abstraction leaks

I gather that in Objective-C I must declare instance variables as part of the interface of my class even if these variables are implementation details and have private access. In "subjective" C, I can declare a variable in my .c file and it is not visible outside of that compilation unit. I can declare it in the corresponding .h file, a...

Valueurl Binding On Large Arrays Causes Sluggish User Interface

I have a large data set (some 3500 objects) that returns from a remote server via HTTP. Currently the data is being presented in an NSCollectionView. One aspect of the data is a path pack to the server for a small image that represents the data (think thumbnail for simplicity). Bindings works fantastically for the data that is already r...

To store images from UIGetScreenImage() in NSMutable Array

I'm getting images from UIGetScreenImage() and storing directly in mutable array like:- image = [UIImage imageWithScreenContents]; [array addObject:image]; [image release]; I've set this code in timer so I cant use UIImagePNGRepresentation() to store as NSData as it reduces the performance. I want to use this array directly after some...

objective c coding guidelines

Is there any pdf which tells about coding guidelines in objective C. For Example... 1. Breaking the function names - checkIfHitTheTrack. 2. member variables must be like - mVariableName. 3. Giving better names to subclass - ? Please share the related links... ...

How to display "number of items" in a tableview?

Hi, What's the best way to implement showing a number in a small circle on a UITableView row, much like is seen on the 'Inbox' row in the image below? Thanks, ...

How to load local images in webview in Iphone sdk?

Hi guys, Here I am getting a problem when I am loading local Image in the webview using html code my image was not diplaying in my webview here is my code for Loading the local image in webview: htmlString = [htmlString stringByAppendingString:@"<table width=85% cellpadding=3 cellspacing=0 border=0> "]; htmlString = [htmlString st...

A white screen is seen when attempting to switch between views!

Hello everyone, I wanted to create a very simple method that switches between views in a view based application. For some reason, when the views are switched, the first view is removed and instead of viewing the second view, I see a white screen. This is my method: FirstViewController *firstViewController = [[FirstViewController allo...

How to intercept click on link in UITextView?

Is it possible to perform custom action when user touch autodetected phone link in UITextView. Please do not advice to use UIWebView instead. And please don't just repeat text from apple classes reference - certainly I've already read it. Thanks. ...

I get EXC_BAD_ACCESS when MaxConcurrentOperationCount > 1

Hello i am using NSOperationQueue to download images in the background. I have created a custom NSOperation to download the images. I put the images in table cells. The problem is if I do [operationQueue setMaxConcurrentOperationCount: 10] and i scroll down several cells the program crashes with EXC_BAD_ACCESS. Every time it crashes at t...

Using NSURLRequest to pass key-value pairs to PHP script with POST

Hi, I'm fairly new to objective-c, and am looking to pass a number of key-value pairs to a PHP script using POST. I'm using the following code but the data just doesn't seem to be getting posted through. I tried sending stuff through using NSData as well, but neither seem to be working. NSDictionary* data = [NSDictionary dictionaryWit...