Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-29-2010, 08:22 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 53
elfarez is on a distinguished road
Default text links??

This is going to sound like a stupid question because i have only been in the iPhone app development program for a week or so. What I would like to know is, is it possible to have links in my text view where if clicked it expands and more text is shown? This may have been worded incorrectly but i don't know how to explain it properly. Basically the reason for doing this is I have an info view that has way too much text for the user to search through to find what they need. I would like to have a title and when the user presses on it more text is shown. I understand it is not protocol for people to just hand out code or specific presiders on the forum but if someone could point me in the right direction it would be greatly appreciated.

Cheers,

Elfarez
elfarez is offline   Reply With Quote
Old 09-29-2010, 09:05 AM   #2 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 577
Speed is on a distinguished road
Default

Quote:
Originally Posted by elfarez View Post
This is going to sound like a stupid question because i have only been in the iPhone app development program for a week or so. What I would like to know is, is it possible to have links in my text view where if clicked it expands and more text is shown? This may have been worded incorrectly but i don't know how to explain it properly. Basically the reason for doing this is I have an info view that has way too much text for the user to search through to find what they need. I would like to have a title and when the user presses on it more text is shown. I understand it is not protocol for people to just hand out code or specific presiders on the forum but if someone could point me in the right direction it would be greatly appreciated.

Cheers,

Elfarez
There are multiple ways to approach this. You can have a table-view with a list of objects, then push a new view or add to a textView when the user selects a row.

Another way would be to connect an IBAction to a button and then when the button is clicked, expand the textView. It would be something like this:

.h
Code:
IBOutlet UITextView *textView;
//We first declare the textView, we would put this inside of the curly braces

}

-(IBAction)myAction;
//We then declare the IBAction outside of the curly braces
.m
Code:
-(void)viewDidLoad {

//When the view loads, set the textView's text to nothing
[textView setText:@""];
//You can also use dot syntax
textView.text = @"";

}

-(IBAction)myAction {

//When the action is tapped, set more text
[textView setText:@"More text here \nNext Line of text\nNext Line"];
/*We separate paragraphs with the characters \n (if you want to make a 
new paragraph, you would add the characters \n)*/

}
This should expand the text when you tap a button. You will have to link the action up to a button in Interface Builder.

So, this code shows you how to set the text of a textView to nothing on startup and then to something when a button is tapped.
Speed is offline   Reply With Quote
Old 09-29-2010, 09:21 AM   #3 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 53
elfarez is on a distinguished road
Default

Quote:
Originally Posted by Speed View Post
There are multiple ways to approach this. You can have a table-view with a list of objects, then push a new view or add to a textView when the user selects a row.

Another way would be to connect an IBAction to a button and then when the button is clicked, expand the textView. It would be something like this:

.h
Code:
IBOutlet UITextView *textView;
//We first declare the textView, we would put this inside of the curly braces

}

-(IBAction)myAction;
//We then declare the IBAction outside of the curly braces
.m
Code:
-(void)viewDidLoad {

//When the view loads, set the textView's text to nothing
[textView setText:@""];
//You can also use dot syntax
textView.text = @"";

}

-(IBAction)myAction {

//When the action is tapped, set more text
[textView setText:@"More text here \nNext Line of text\nNext Line"];
/*We separate paragraphs with the characters \n (if you want to make a 
new paragraph, you would add the characters \n)*/

}
This should expand the text when you tap a button. You will have to link the action up to a button in Interface Builder.

So, this code shows you how to set the text of a textView to nothing on startup and then to something when a button is tapped.
Thanks so much! that was a huge help
elfarez is offline   Reply With Quote
Reply

Bookmarks

Tags
easy, link, text, title

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 343
6 members and 337 guests
headkaze, mistergreen2011, nobstudio, Objective Zero, revg, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,655
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pungs
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:09 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0