cocoa-touch

UIPickerView problem about selecting first value

Hi all, I succesfully implemented a UIPickerView. However, I have a problem in selecting values. According to the standard way, I have implemented the method - (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { // method implementation... } The problem is when I try to sel...

How should I organize a project with three distinct views and no tab/tool/navbars?

I've spent too much time walking down dead ends on this project, so it's time to query the hive mind: I am making a simple iPad game consisting of three locations which the user navigates between when an area of the screen is touched. These locations are represented by fullscreen images and there are a lot of different animations and st...

Flip the Image when saving out to disk

I am currently using the following code to write a CGContext to a PNG on disk: CGImageRef image = CGBitmapContextCreateImage(context); UIImage *myImage = [UIImage imageWithCGImage:image]; NSData *data = UIImagePNGRepresentation(myImage); [data writeToFile:path atomically:YES]; I found that the orientation of the resultant file is flip...

determine if uiview is displayed

hey! is there a possibility to determine if an uiview obj is going to be displayed. imagine: you have 2 uiviews in an uiscrollview. now you are going to switch per gesture from the first view to the second. the first view now is NOT in the viewport. now you are going to go back to the first view. and now I want to be notified that this ...

Prevent UISCrollView to scroll unless it was touched near edges

I have the following situation: A UIScrollView contains a UIWebView. I want the content inside the web view to be touchable, but the scroll view should not scroll unless it was touched near the left or right edge. I have subclassed both UIScrollView and UIWebView to try to override methods like hitTest and pointInside but no go so far. ...

UIAlert partially hidden on iPad horizontal orientation. How to move it up?

In my iPad app, I have an implementation of a login window as a UIAlertView subclass that adds two UITextField, using an idiom that's found on the net. The problem is that in horizontal orientation, the alert is partially hidden by the keyboard. Namely, the buttons are hidden. Of course, it's possible to hide the keyboard to reveal the ...

Making a request to a web service for logging purposes in Objective-C

Hello friends. I have a web service with a URL like this: http://webservice.com/?log=1 I would like to make a request to this URL in Objective-C such that the web service can log that fact. I don't care to pass anything on to the web service and nor do I care how it responds to the request. What is the most effective way to achieve th...

ASIHTTPRequest: Results are not populated at the right time when using an asynchronous request

Hello all, I've my own class which should do the request and the data processing (parsing). This class should be used from different view controllers. In this class I have implemented: - (void)sendRequest:(NSString *)url; - (void)requestFinished:(ASIHTTPRequest *)request; - (void)requestFailed:(ASIHTTPRequest *)request; - (id)parse:(NS...

How to get screen size using code?

Hi everyone, I would like to get the iphone screen size to give calculation, but I did not found any documentation how to get it. Would you please figure it out for me? Thanks ...

Store preferences in a file and import values to initialize variables

Hi, I want to store the content of some variables in a file. The user nor the application should change the value. It would be great if the user cannot read the content of this file. On startup the application reads the file and initialize some (global?) variables with the content. The file should contain some values like server URL an...

Ipad Simulator not auto rotating

I have an an iphone app and am using shouldAutorotateToInterfaceOrientation to determine when to autorotate. On the iphone, I specify that UIInterfaceOrientationPortrait is the only allowed orientation; On the iPad, I just return YES (ie all allowed), like so: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interf...

Images in "selected" UITableViewCells

My client's design calls for a table with cell content on irregularly-shaped white areas--basically a rectangle with a "tail". I'm constructing that out of a UIView and a transparent UIImageView holding the "tail" part of the design. It looks nice, with one exception. When I select a cell, the whole thing turns blue EXCEPT the UIImages....

Does UITableView's indexPathsForVisibleRows return the wrong paths?

Hi there, I use the following code to trigger image downloads in visible cells/paths: - (void)loadImagesForOnScreenrows { NSArray *visiblePaths = [tableView indexPathsForVisibleRows]; for (NSIndexPath *indexPath in visiblePaths) { UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; if([cell viewWithT...

Why am I seeing a black screen when my universal application comes back to the foreground?

I have a universal iPhone / iPad application that I'd like to have support multitasking. On a multitasking OS, when my application goes to the background and then returns to the foreground, all I see is a black screen. What could be causing this and how do you suggest I work around it? ...

Integrating Google Checkout in iOS App

Am I correct in assuming using a UIWebView is the only/best way to integrate Google Checkout into an iOS App? A fully native solution would be the best fit as I only require the user to purchase a limited number of items that will never change. Does any one know of existing Apps that have successfully integrated Google Checkout? ...

UITextView with Syntax Highlighting

I've found a question on this already but it didn't have a complete answer to it. Is there a Framework or Library that can do Syntax Highlighting in a UITextView, specifically syntax highlighting (and detection) for Objective-C on the iPhone. Some of my Ideas of how to do this: NSAttrbutedString. Now available in iOS 3.2 and greater...

iPhone: mechanism for adding and reading app-wide data

Hello friends. I'm looking for a mechanism to add and read app-wide data, something similar to Web.config under .NET. I'm thinking of creating an AppConfig.plist, and in there I'll store URLs to web services, etc. so that these values can be read and used throughout the app. Is this an effective way to achieve what I'm after? Do you g...

How do you access the current user's record in Address Book?

Is there a way in the Address Book API to access the current user's record programatically? In other words, if this iPhone belongs to John Smith, to get the contact record that is John Smith (whichever record is marked as Me in Contacts)? Obviously you can popup the picker and let the user select themselves from their Contacts, but th...

UIPicker first appears black

I have the following code to draw a custom picker. Unfortunately when the view is first drawn is black. Only when I touch it does it appear. How can I fix this? Here is the relevant code in the UIView: - (void)drawRect:(CGRect)rect { [self createPicker]; [self addSubview:dPicker]; //[dPicker reloadComponent:1]; } -(void) cr...

Selecting Multi-Value Element in settings bundle not returning to previous page

My settings bundle specifies a Multi-Value element of type PSMultiValueSpecifier exactly as described by Apple here. I have all the required Keys entered, as well as the Titles array matching the values array in size. The default value is an integer, and matches a value in the values array (so no problems there). My issue is a usabili...