uikit

How do I size a UITextView to it's content?

Is there a good way to adjust the size of a UITextView to conform to it's content? Say for instance I have a UITextView that contains one line of text: "Hello world" I then add another line of text: "Goodbye world" Is there a good way in Cocoa Touch to get the rect that will hold all of the lines in the text view so that I can adjust...

How do I create blurred text in an iPhone view?

I am building up a view with various text and image elements. I want to display some text in the view with a blurry copy of the text behind it, but not just a text shadow. How do I apply Gaussian blurred text onto a UIImage or layer? ...

Adding the "Clear" Button to an iPhone UITextField

How do you add that little "X" button on the right side of a UITextField that clears the text? I can't find an attribute for adding this sub-control in Interface Builder in the iPhone OS 2.2 SDK. Note: In the iPhone 3.0 SDK, you can do this in Interface Builder. ...

How to change UIPickerView height

Is it possible to change the height of UIPickerView? Some applications seem to have shorter PickerViews but setting a smaller frame doesn't seem to work and the frame is locked in Interface Builder. ...

iPhone: Putting only one section of UITableView in Edit mode

I have three sections in my hypothetical UITableView. I'd like one section that is in editing mode. The rest of the sections to not be in editing mode. Is this possible at all? ...

How do you add multi-line text to a UIButton?

I have the following code... UILabel *buttonLabel = [[UILabel alloc] initWithFrame:targetButton.bounds]; buttonLabel.text = @"Long text string"; [targetButton addSubview:buttonLabel]; [targetButton bringSubviewToFront:buttonLabel]; ...the idea being that I can have multi-line text for the button, but the text is always obscured by the...

Where is the UIWindow instantiated in an iPhone app?

When you create an application from the "View-Based" template in the iPhoneSDK the following code is generated. I basically understand what is happening here, but I do not see where window and viewController are instantiated. Any Help? @class jojojViewController; @interface jojojAppDelegate : NSObject <UIApplicationDelegate> { UIWi...

How to use scroll view on iPhone?

I want to display a text with a lot of lines. I added a multiline-label to a scroll view, but it didn't show anything. Looks like this is not the correct way to use the scroll view. How to use scroll view so that users can drag down to see more text? ...

How to create an Instance Variable in Objective-C

I have this example, and I would like to make my_Picture an instance variable in order to use removeFromView. Any Ideas? I got all kinds of warnings and errors trying different approaches. Thank you in advance - (void) viewDidLoad { UIImageView *my_Picture = [[UIImageView alloc] initWithImage: myImageRef]; [self.view addSubview:my...

iPhone SDK: IBAction

I have a situation where I'd like a button to respond to two different IBAction methods. Is there a way that I can force a particular method first? When I look at the buttons connections in IB they are in the correct order, but they consistently perform in the opposite order. ...

UISegmentedControl Behaviour

Hey guys, A quick question about the UISegmentedControl class on the iPhone. Hopefully, some may have noticed how in its default state with 2 segments, the segmented control still will toggle even if the user taps on a segment that is currently selected. I've seen UISegmentedControls in apps that negate that behaviour and don't toggle...

UIActionSheet - Unknown Number Of Buttons, How to know what to call?

Hey guys, I have a UIActionSheet with an undetermined number of buttons. I'll need to use the delegate method buttonClickedAtIndex: (or something similar) to decide what method to call when the user clicks a button. The problem is: how do I decide which button is clicked when different buttons will appear at different indexes in differ...

Changing color of all interface elements of the same type

Hello, I am wondering if it is possible to change a default color of buttons in my application with a couple lines of code? It may be really boring to manually change color of each button. Especially if you have lots of them. For example, I want all of my buttons to be orange instead of original white. Thank you in advance, Ilya. ...

Checking if a UIViewController is about to get Popped from a navigation stack?

Hey guys, I need to know when my view controller is about to get popped from a nav stack so I can perform an action. I can't use -viewWillDisappear, because that gets called when the view controller is moved off screen for ANY reason (like a new view controller being popped on top). I specifically need to know when the controller is a...

Multiple Hierarchy levels with navigation Controller

I'm trying to get multiple levels of hierarchy working with Navigation Controllers. I have 3 levels of hierarchy and I can move down through the levels of hierarchy, but I can only go back one level and not two levels, back to the starting view. I start by creating a navigation controller for View #1 and push the next view, View #2, o...

How do I detect a touch over a specific area

Currently I see that a touch event will show me the UIView where the touch occured. But what if I need to detect a touch of some non rectangular shape, like a circle. How would I go about doing something like that ? Basically I want to do something only if the user touches somewhere within a circular area that's not visible. Any help/...

How to create multiple buttons dynamically and handle their separate events? + iPhone SDK

Hi All, Now I am creating a IPhone App. I need to create multiple buttons dynamically and handle their corresponding events separately. Can each button events behave separately, or can I send a variable or an object to a method and depending upon that value differentiate the button behavior. Can anybody point me to how to do that? Plea...

How do i add button style cells to table views in iPhone apps?

I'm not able to find any specific examples in apple's documentation on this. I want to add two to three buttons to a table view programmatically, much like the contacts app does with the send text message/ add to favorites buttons on a contacts's info. does anyone know how to configure this? ...

draw a line in UIImageView problem

In my application i can draw a line in a UIImageView by the code below,and i want redraw the line even longer when i call the function,however,the output come out is not as expected,it will just draw a new line and remove the old one,the length is remain the same jus the y position different,i dont know which line of my code is wrong or ...

Handling URL Redirections in UIWebView

Hey guys, I have a UIWebView in my app that is used to show webpages of links clicked within my app. Some of the links are URL-Shortened links, such as tinyURL or bit.ly. These url's redirect after the initial url load. My problem is that some of the links in my app are URL-Shortened links to resources that are not webpages - such as ...