uikit

UIAlertView display an informative statement with OK

I want to display a UIAlert to indicate to my users that something went wrong (maybe no Internet). I just need an OK button. Thanks for the help :) ...

retaining a list of all local push notifications in iOS 4

As part of an app I'm writing, it keeps a list of reminders and uses local notifications to display them at the required time. What I would like to determine is a list of these notifications so that I don't have to recreate the list upon each edit or new notification. Is there any documentation or examples/tutorials that demonstrate th...

How to put a small custom toolbar above the Keyboard that moves up and down with it?

How to put a small custom toolbar above the Keyboard that moves up and down with it? ...

Unable to disable animation of CALayer>>removeFromSuperlayer

I wish to remove a CALayer from its superlayer without animating. What happens here is the layer animates to a position, works great, when however the animation stopped, this code is executed, which returns the layer to its start position, and fades out; presumably then gets removed from the superlayer. How may it be stopped from animati...

UITableView: Recovering from NSInternalInconsistencyException after bad updates?

So I'm updating a tableview by inserting/deleting/reloading rows as needed, but, as I'm not 100% confident that the tableview will always update correctly, is there any way to fail safely from a bad batch of updates? Right now, I have this: // Try to animate the updates. If something goes wrong, just reloadData. @try { ...

Calculate the height of a UITextView's text with sizeWithFont:constrainedToSize:lineBreakMode doesn't seem to return correct results

Hey, I'm trying to calculate the height of the text constrained by a UITextView but it doesn't seem to return correct results. Here is my code : - (void)textViewDidChange:(UITextView *)aTextView { CGSize textSize = [aTextView.text sizeWithFont:aTextView.font constrainedToSize:aTextView.frame.size lineBreakMode:UILineBreakModeWordW...

iPhone SDK - How to create a modal view with navigation controller in it?

I have a view controller that will be presented via presentModalViewController. Within the view managed by this controller is a table view, I want the view to be managed by navigation controller so if you tap a row cell of the table view, it will push the next view controller onto the stack. Problem is currently there is no way to pres...

UIImagePNGRepresentation() and scale (iPhone 4 screen)

I've got some image generating code that uses UIGraphicsBeginImageContext(), UIGraphicsGetImageFromCurrentImageContext() and UIImagePNGRepresentation() to do some drawing, then save it to disk as a PNG for later use. Does UIImagePNGRepresentation() take into account scale? As in, if I have an image that is 20 points wide, will the resul...

How to auto-resize UIView proportionally?

I have a UIView whose height should always be exactly 1.5 times the width. When the view is auto-resized (in this case, because the iPhone is rotated), this proportion gets messed up. How can I make sure the height/width ratio doesn't change as the view resizes? ...

How can I add a subview to the bottom of a UITableView?

I am using the EGOTableViewHeader class provided from: http://www.drobnik.com/touch/2009/12/how-to-make-a-pull-to-reload-tableview-just-like-tweetie-2/ I am able to display my view at the top of my UITableView: refreshHeaderView = [[EGORefreshTableHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f - self.tableView.bounds.size.heigh...

How can I automatically set the orientation of an iPhone subview?

I'm going in circles here. I have set shouldAutoRotateToInterfaceOrientation for all the view controllers. My app is running correctly in landscape, like this: However, when I add a new subview using [window addSubview:whatever.view]; it shows up like this: How can I make the new subview automatically be added in landscape orientatio...

How to infer sizes and avoid magic sizing numbers

Following on the heels of this question, I'd like to know how to remove the magic numbers in lines like: CGRect pickerFrame = CGRectMake(0, 40, 0, 0); closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f); [actionSheet setBounds:CGRectMake(0, 0, 320, 485)]; or UIDatePicker *theDatePicker = [[UIDatePicker alloc] initWithFrame:CGRect...

UIButton image/background image weirdness

I have a custom UIButton in my viewcontroller that should have either the image of either a red or blue heart depending on the value of a variable when the viewcontroller is loaded. If the user clicks on the button, it changes the Red/Blue value in the domain model and should also toggle the button image. The button color will load corre...

Stuck on using uinavigationcontroller

I am creating a navigation project on IPhone SDK. In briefly, my project can do a log in action. After I click a log-in button to log in. It crashes.... I Found that it failed in DisclaimerController *disclaimerController = [[DisclaimerController alloc] initWithNibName:@"DisclaimerPage" bundle:nil]; UIViewController *targetViewControll...

CALayer performance vs. UIImageView performance

I'm noticing that some of the things that I do with images in my app, I could be doing with CALayer properties instead (i.e. borders, shadows, gradients, and so on). So I'm wondering, in general, is it a better idea to use CALayers and such, or just do all that stuff in photoshop and use UIImage(View)s for whatever I need? Scrolling perf...

How can I switch the iPhone's screen/backlight on/off in my App

My app needs to go to sleep and wake up after a user specified time interval. Using [UIApplication sharedApplication].idleTimerDisabled = YES; I'm ignoring the idle timer. For the "sleep-mode" I'm turning the view to all black and hide the status bar. Still there's the device's background-light. Is there a way to turn it off or hit a ...

Disabling the NavBar Edit Button

I have a UITableView. On my navbar I have an edit button. I want to be able to enable and disable it depending on certain conditions. For instance, when the user deletes the last of a certain type of row I want to gray out the Edit button as there are no more of these rows to delete. What I do at the moment is check in - (void)tableVi...

Get UIViewController associated with a UITabBarItem

I have a UITabBarController with a bunch of tabs. When a new tab is selected, I want to be able to access the UIViewController associated with that tab. The -(void)tabBar:(UITabBar*)tabBar didSelectItem:(UITabBarItem*)item method on UITabBarDelegate gives me access only to the UITabBarItem. Any suggestions on how go from this to the UI...

How to create a user control for IPhone?

So I read about Interface Builder Plug-Ins but from what I understood they're not supported on IPhone on the MAC. Basically I want to create a User Control (this is a .NET term) is this possible in iPhone development? A user control is basically like me trying to create my own custom button, or own custom slider, etc so that it is easil...

iPad app with multiple UIWebViews in the same screen

does it hurt performance to have multiple UIWebViews in the same screen? how do I use a busy indicator while the web page is loading and display the fully loaded page once all contents have been downloaded? ...