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 01-13-2010, 04:21 PM   #1 (permalink)
Registered Member
 
chall2009's Avatar
 
Join Date: Dec 2009
Posts: 35
chall2009 is on a distinguished road
Default Quick UISegmentedControl Question: How do I set what button is selected?

So I know to set the default view of a switch you use the following:
Code:
[mySwitch setOn:YES animated:NO];
What is the way to do this with the UISegmentedControl so that I can select a certain button in viewDidLoad?

Thanks in advance!

P.S. -- I tried:

Code:
[mySegment isEnabledForSegmentAtIndex:0];
but that didn't work.
__________________
Best Regards, Chris
www.ChallTech.com
My iPhone App: StrokeWatch [App Store]

Last edited by chall2009; 01-13-2010 at 04:24 PM.
chall2009 is offline   Reply With Quote
Old 01-13-2010, 04:29 PM   #2 (permalink)
Beast Iphone Developor
 
justill45's Avatar
 
Join Date: Aug 2009
Location: Atlanta, Georgia
Age: 16
Posts: 1,302
justill45 is on a distinguished road
Default

Quote:
Originally Posted by chall2009 View Post
So I know to set the default view of a switch you use the following:
Code:
[mySwitch setOn:YES animated:NO];
What is the way to do this with the UISegmentedControl so that I can select a certain button in viewDidLoad?

Thanks in advance!

P.S. -- I tried:

Code:
[mySegment isEnabledForSegmentAtIndex:0];
but that didn't work.

you can do it in interface builder if you want, im not sure how programatically though
justill45 is offline   Reply With Quote
Old 01-13-2010, 04:33 PM   #3 (permalink)
Registered Member
 
Join Date: Oct 2008
Posts: 97
fordracerguy is on a distinguished road
Default

use:

mySegment.selectedSegmentIndex = 0;

Last edited by fordracerguy; 01-13-2010 at 04:41 PM.
fordracerguy is offline   Reply With Quote
Old 01-13-2010, 04:48 PM   #4 (permalink)
Registered Member
 
chall2009's Avatar
 
Join Date: Dec 2009
Posts: 35
chall2009 is on a distinguished road
Default

Quote:
Originally Posted by fordracerguy View Post
use:

mySegment.selectedSegmentIndex = 0;
Worked beautifully. Thanks!
__________________
Best Regards, Chris
www.ChallTech.com
My iPhone App: StrokeWatch [App Store]
chall2009 is offline   Reply With Quote
Reply

Bookmarks

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: 332
10 members and 322 guests
2Apps1Day, akacaj, Domele, michelle, NSString, SLIC, Sloshmonster, soohyun, Techgirl-52, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,650
Threads: 94,114
Posts: 402,886
Top Poster: BrianSlick (7,990)
Welcome to our newest member, soohyun
Powered by vBadvanced CMPS v3.1.0

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