uikit

Why No NSAttributedString on the iPhone?

Hey guys, Does anyone know what made Apple leave out NSAttributedString when turning AppKit into UIKit? The reason I ask is that I would really like to use it in my iPhone app, and there appears to be no replacement or alternative than doing it myself... It is possible to have mixed font attributes on a string - it's just a hell of a ...

Simpler Solution For Playing Audio on an iPhone

Apple lists (http://developer.apple.com/samplecode/AudioQueueTest/listing1.html) as a quick demonstration of playing an audio file. Is there a way to play an audio file with many less lines of code? ...

iPhone Disabling UIActionSheet buttons

I want to disable buttons in the UIAction sheet and enable them after a certain condition is true. How do I achieve this? Any ideas? ...

ObjC - Post a UIImage by using NSData and NSURLRequest?

Hey all, I'm trying to post an image to TwitPic.com using their API. However, I have never posted an image using HTTPPOST or however else before. Anybody enlighten me to how I can post NSData from a UIImage using their api? ...

How to lose margin/padding in UITextView?

Hello, I have UITextView view in my Iphone application which displays large text and I am paging that text with offset margin, but the problem is, that it has some kind of margin or padding and it messes up my calculations (it seems to be diffferent depending on font style). Is it possible to get rid of that unnessecary space around UI...

Using HTML and Local Images Within UIWebView

Hey guys, I have a UIWebView in my app which I want to use to display an image which will link to another url. I'm using <img src="image.jpg" /> to load the image. The problem is that the image doesn't load (ie. it can't be found) even though it's added as a resource in my project and is copied into the bundle. I've tried using NSB...

How do you optimize UIColor on the iPhone?

I'm creating a simple color picker controlled by a custom slider type control. I'm passing a float value from my slider to a UIColor constructor method and updating the background color of a CALayer as the value changes. It runs really smooth in the simulator, but I get a lot of flickering when running on the device. Is this just bec...

Adding Emboss to a UILabel in a navigationItem.titleView (as seen with navigationItem.title)

I'm trying to mimic the default emboss that automatically gets applied to navigationItem.title, as well as many other UIKit controls. As seen in this screenshot's title ("Table Cells"): I'm essentially trying to add 2 UILabels to the navigationItem.titleView, however the UILabels just show up as flatly drawn and it really just doesn'...

Customizing UISlider look

To customize the visual look of a UISlider you can set the thumb and track images. Part of the track images gets stretched to the appropriate with. From the documentation: A stretchable region sits between two end cap regions. The end caps define the portions of the image that remain as is and are not stretched. The stretchab...

Do I have the right understanding of frames and bounds in UIKit?

Let me try to explain it. Please tell me if I am wrong. I am just 70% sure about it. Like I understand it, an UIView has a frame and an bounds rectangle. The job of the frame rectangle is to set the position of the UIView relative to it's superview. More precisely: Relative to the coordinate system of the superview. The job of the bound...

How can I stretch or jar an image inside an UIImageView?

Apple says, that all I have to do is to modify the bounds rectangle. Then the content inside the bounds rectangle would be stretched or jard into the frame rectangle. But when I assign another CGRect with a smaller width to my bounds rectangle, nothing happens. The UIImageView keeps looking exactly the same. No compile errors. I guess t...

Which are the Top Level Objects I need to create Outlests for in the File's Owner of my Nib, so that I have less memory problems?

Apple says, that I need to have Outlets in my File's Owner for all my top level objects in a Nib file. As much as I know, these objects are NOT the File's Owner itself (would make no sense, right?) and the First Responder. I am unsure about: The View object in the Nib, and any controller object in the nib. Do I need an outlet for thos...

What do I have to consider in an multiview-application, when it comes to low memory warnings?

Somewhere I was reading that I would run into memory problems when I give up a view temporary due to an low memory warning (loading it again as soon as the user wants to see it), if theViewController class does not do things like this on every outlet of that view: -(void)dealloc { [myView release], myView = nil; [myLabel release...

Which iPhone OS memory management rules and how-to's do you know? What great links do you have for that topic?

Currently I am jumping into the ice cold water called "memory management in iPhone OS". Here's one rule i've learned: Every time I see an alloc in my method, I will release that corresponding variable at the bottom of the method. Every time I create an @property(...) in my header file which says copy or retain, I put a release message...

Why don't I have to release these objects?

Here's an sample code, where only the "string" object is released. NSString *nameOfFile = ... ; NSError *error; NSString *string = [[NSString alloc] initWithContentsOfFile:nameOfFile encoding:NSUTF8StringEncoding error:&error]; if (string == nil) { // handle error } [string release]; I understand why the error object is not releas...

Where is the difference between Retain Counting and Reference Counting?

I feel that both are the same thing, but I am not sure. ...

Will the -dealloc method be called upon application quit?

Apple says, that in Cocoa -dealloc will not be called neccessarily when the application quits. Does this also apply to the iPhone? ...

Does a collection send a -release message to all objects it holds, if I send it an -release?

I've been reading that if an collection "gets released" it releases all it's objects as well. On the other hand, I was also reading that a collection would release it's objects as soon as the collection gets deallocated. But the last thing may not always happen, as apple says. The system decides if it's good to deallocate or not. In mos...

Where are all the pre-installed autorelease pools in iPhone applications?

I am wondering how many there are, and where they are. As I have seen in a Stanford Vid, there is one autorelease pool installed in the event loop of an iPhone App. But I think I missed the point where exactly that is? And are there any other autorelease pools that I should know about? ...

is the main.m really the place, where the autorelease pool of the main run loop is created by every event?

#import <UIKit/UIKit.h> int main(int argc, char *argv[]) { NSLog(@"new event..."); NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; return retVal; } If that's the case, then the main() function would have to be called on every event, ...