|
|
![]() |
|
|
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:
You must Login or Register to view and contribute code! This is done to increase participation in helping one another out, if you have been helped please pass on the favor. [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) |
|
Member
Join Date: Oct 2008
Posts: 31
|
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:
You must Login or Register to view and contribute code! This is done to increase participation in helping one another out, if you have been helped please pass on the favor. [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:
You must Login or Register to view and contribute code! This is done to increase participation in helping one another out, if you have been helped please pass on the favor. IBOutlet UILabel display; Than you defineed an IBAction Code:
You must Login or Register to view and contribute code! This is done to increase participation in helping one another out, if you have been helped please pass on the favor. - (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:
You must Login or Register to view and contribute code! This is done to increase participation in helping one another out, if you have been helped please pass on the favor. - (IBAction)buttonPressed:(id)sender {
display.text = @"Hello World";
}
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Search Engine Friendly URLs by vBSEO 3.3.0 RC1 |





Linear Mode
