iphone

How to check if a specific UIViewController's view is currently visible?

I'm developing an app that processes a constant stream of incoming data from the network and provides a number of different UIViews for the user to view that data. When certain model data gets updated based on the incoming stream from the network, I access the associated UIViewController or UITableViewController and do -setNeedsDisplay ...

Upgraded to SDK 4.1 and can no longer build for iOS 4.0

Just upgraded my xcode to the latest SDK which has the iOS 4.1 SDK. My app was built for 4.0, but xcode is no longer letting me build for 4.0 (The SDK is missing). I'd prefer not to require 4.1 yet as the app doesn't need it and it just came out yesterday. Any ideas to allow me to build for 4.0? I don't see an option to download the...

Routing iPhone Audio Sound

I have an app which does listen and play sound at the same time. By default, the sound output goes through the earphone. So I use the following code to route it through the speaker: UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute, sizeof(audioRouteOve...

centering a CGRect in a view

I have an image displaying in a CGRect. how do I center the rect in the view? here's my code: UIImage * image = [UIImage imageNamed:place.image]; CGRect rect = CGRectMake(10.0f, 90.0f, image.size.width, image.size.height); UIImageView * imageView = [[UIImageView alloc] initWithFrame:rect]; [imageView setImage:image]; I've tried imag...

awakeFromNib (loadNibNamed) not called on iPad device - works fine on simulator

I made an universal app for iPhone and iPad with this code (from an Apple Sample-Code): - (void)applicationDidFinishLaunching:(UIApplication *)application { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { // load the content controller object for iPhone-based devices [[NSBundle mainBundl...

VPN connection with Objective-C

Hi Developers! Is there a way to establish a VPN connection programmatically in Objectiv-C for the iPhone? Are there somewhere good tutorials for this? Does anyone know? Thanks Taimur ...

Try-catch exception handling practice for iPhone/Objective-C

Hi all, Apologies if this question has already been answered somewhere else, but I could not find any decisive answer when searching on it: I'm wondering when try-catch blocks are to be used in objective-c iPhone applications. Apple's "Introduction to the Objective-C Programming Language" state that exceptions are resource intensive an...

Smartphone app design document template?

Hello all, Im looking for a design document (templat) for smart-phone applications, I don't really mind which platform, because it should be easily transferable! I am aware that there are lots of widget & icon design guide lines available but I am also looking for some more high-level, well-rounded design such as use-case, uml diagrams,...

iPhone - Force localization of Default.png

I know how to force localization with this code [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"fr", nil] forKey:@"AppleLanguages"]; And I know how to localize Default.png (different bundles English.lproj, French.lproj...). Now imagine the phone language is English, but the user set the application langua...

UIView background color not set until device rotates

I'm working with a simple iPad application, and I've got a simple problem. I'm setting up a custom UIView; here's my initWithFrame: - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { self.backgroundColor = [UIColor colorWithWhite:.4 alpha:1.0]; .... } return self; } The ...

index search feature for UITableView

I'm using an index search feature for a tableview. at the moment it shows just the first letter of the index to display. is there a way to display the full name of a section instead of just the first letter? so instead of: A B C it would display Appetizers Entrees Deserts here's what I'm currently using: (NSArray *)sectionInde...

iPhone/iPad Application Development Limitations

Hi, Its quite annoying sometimes when you have no authentic sources to confirm if particular tasks can be done using iPhone Available (Public) APIs. Whats the preferred way of finding it out?. Shall we go through iPhone documented APIs, Ask senior developers ( which i dont prefer, you should not depend on others too much and theres ...

Set Multiple Variables to Same Value

Hi I have dozens of NSStrimgs that when the app loads I want to all be set to the same set. All of them. How can I do this without typing out every single one? Is there a shortcut method? Thanks. ...

when i press a stop button in web view it should stop loading content

i am using web view stop button to do this is working,but i want to write ibaction for this and when i press this it should stop loading content how to stop web view to load... ...

iphone 4.0 - Native apps UIEvent source

Do native apps like camera broadcast any notifications? Alternately, is it possible to infer from UIEvent class whether the event is associated with native apps like the camera? Do the event type/subtype give out that information? ...

How to programatically dismiss a UISearchBar?

I have a standard table view, with a UISearchController implemented via a NIB. I want to mimic what happens when the user clicks "Cancel" in the search bar - the normal behaviour is that the search bar goes away and the table returns to its original state. Basically, I want to have the same happen when the user selects an item that appea...

Get target name (or icon name) in my code

Hello all, Have been searching for this, I need to have a conditional statement in my objective C code based on the target, but I can't seem to find a direct way to get the target name from the code. Have been trying to read the icon value from the bundle using: NSLog(@"Icon File: %@",[[NSBundle mainBundle] objectForInfoDictionaryKey:...

Full screen UIImage view

I have an application with a navigation bar and a tab bar. A user can navigate to a view which displays images in a scroll view. I'd like to have the same behavior as the iPhone photo app: Nav bar at the top, tool bar at the bottom, which will hide or show based upon a tap. I'm moving my view to the window object in order to achieve f...

Making a custom Button using a UIView or overriding UIButton?

Hi guys, I need to generate a custom button through code, this is how i am currently doing it. -(void) initialiseButtons { int ypos = playerImage.frame.origin.y + playerImage.frame.size.height + 8; for(int i=0; i<totalButtons; i++) { UIButton *newButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; ...

Determining which button was pressed in one of the two UIAlertViews

I have two UIAlertView's which are not displayed one after another. Both of the have two buttons and I need to determine which button was pressed. I've tried to use - (void)alertOKCancelAction { UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Title" message:@"Message" delegate:self...