|
|
![]() |
![]() |
|
LinkBack | Thread Tools | Display Modes | ![]() |
|
|
#1 (permalink) |
|
Junior Member
Join Date: Nov 2008
Posts: 4
|
Hi, I'm trying to make an iPhone app that displays text when you press a button. I'm using this code:
Code:
[display setStringValue:@"Hello World"]; I'm assuming that code may only be Cocoa and not Cocoa Touch. Can someone let me know what code I should use? Thanks in advance. |
|
|
|
|
|
#2 (permalink) |
|
Junior Member
Join Date: Oct 2008
Posts: 29
|
Hi Nickel,
Any iPhone app has an UIView at it's base, the UIView does not have the property to display text it does not know how to. Instead use an UILabel/UITextViewController anything with a text property to add on your UIView. And when you press the button you should tell your label/controller to display the text. Regards, Sergiu. |
|
|
|
|
|
#4 (permalink) |
|
Junior Member
Join Date: Nov 2008
Posts: 4
|
Thanks for the response. So I made a UILabelController.
Do I keep the display outlet in my main or put it in Label Controller? What do I connect the display outlet to? Is this code right?: Code:
[display setStringValue:@"Hello World"]; Thanks. Last edited by Nickel; 11-12-2008 at 07:40 PM. |
|
|
|
|
|
#5 (permalink) | |
|
Junior Member
Join Date: Oct 2008
Posts: 14
|
Quote:
Code:
IBOutlet UILabel display; Than you defineed an IBAction Code:
- (IBAction)buttonPressed:(id)sender; If you have not done that, you can set the text in the display variable as often as you want, it will not have any effect! If you did everything right, you have an implementation of the IBAction which might look like following: Code:
- (IBAction)buttonPressed:(id)sender {
display.text = @"Hello World";
}
|
|
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd. Search Engine Friendly URLs by vBSEO 3.3.0 RC1 |


Forum
Register
Quick Links
Members
UserCP
Calendar
Search
FAQ




Linear Mode
