Skip to main content

Posts

Showing posts with the label uikit

UIImagePickerController, UIImage, Memory and More?

I've noticed that there are many questions about how to handle UIImage objects, especially in conjunction with UIImagePickerController and then displaying it in a view (usually a UIImageView ). Here is a collection of common questions and their answers. Feel free to edit and add your own.

Great UIKit/Objective-C code snippets

New to Objective-C iPhone/iPod touch/iPad development, but I'm starting to discover lots of power in one-liners of code such as this: [UIApplication sharedApplication].applicationIconBadgeNumber = 10; Which will display that distinctive red notification badge on your app iphone with the number 10. Please share you favorite one or two-liners in Objective-C for the iPhone/iPod touch/iPad here. PUBLIC APIs ONLY .

View floating above all ViewControllers

Is it possible on iOS that a view always floats above all other views. I ask this because what I would like to achieve is a view that floats above a ViewController, and then a Modal View Controller slides in, whilst that particular view is still floating over that Modal View Controller (hope you get what I am trying to say).

CADisplayLink with NSRunLoopCommonModes not executed for every frame when tracking UIScrollView?

I am trying to execute a small piece of code on every single frame in a regular (non-OpenGL) iPhone app. The goal is to have a frame counter so that I can measure (rather than guess) where the slow points in the app are and fix them to create a better user experience. What I've done so far is register a CADisplayLink for all modes (including tracking): CADisplayLink *displayLink = [[CADisplayLink displayLinkWithTarget:self selector:@selector(frame)] retain]; [displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; The code that is executed looks like this (lastDraw is a NSDate* and count an int): - (void) frame { NSDate *newDate = [NSDate date]; if([newDate timeIntervalSinceDate:lastDraw] >= 1) { label.text = [NSString stringWithFormat:@"%d FPS", count]; count = 0; [lastDraw release]; lastDraw = [newDate retain]; } count++; } The idea here is to get an update every one second as to how many frames were drawn in the past s

UIImage Resize without loss of quality

Im looking for an external library (or a method using Apple frameworks that doesn't destroy the quality) which will let me scale down images. I have tried this 'simple-image-processing-library' but it only works for black and white - I don't know how to make it work for colour images. ( http://code.google.com/p/simple-iphone-image-processing/ ) I have tried Core Graphics, UIKit, the "trevor" ( http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/ ) method - which makes EXTREMELY blurry images and really I don't know what else I can do - I can't continue programming my app without getting at least half-decent image scaling working. I think interpolation is needed to get decent results. Given the recent advances in iOS, I really hope someone can help me. This isn't a problem that only I am having, lots of other people seem to have the same problem, so if someone could solve it here, I'm sure if would appreciated by a

How to programmatic segue from one UIViewController to another without Modal or Push?

If one UIViewController is a login screen, and the next one is the app's home screen, what would be the most optimal way to program the transition. I figure the modal segue class is inappropriate for this situation since ideally the transition to the home screen would be permanent, not temporary. But Push didn't make any sense either, since the login screen isn't a Navigation controller, and that isn't the functionality I'm looking for anyway. What would be the best way approach this specific case? Thanks!