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 08-13-2010, 06:43 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 72
santosh_kumar is on a distinguished road
Default UISegmentedControl problem( loading different views)

Hi all, I created a segmented control with 2 segments(button,textfield).I need to load only the selected segment on to the screen below the segmented control.When i select button first and textfield second, button should not appear on the screen and is same for the textfield. I tried with "hidden" and "removeFromSuperview" but not worked. So please help me.

Thanks in advance.
Santosh.
santosh_kumar is offline   Reply With Quote
Old 08-13-2010, 10:45 AM   #2 (permalink)
Registered Member
 
Join Date: Jan 2009
Location: Long Beach, CA
Posts: 612
bytor99999 is on a distinguished road
Send a message via AIM to bytor99999 Send a message via Yahoo to bytor99999
Default

Please post your code so we can see where you went wrong. removeFromSuperview should be the best to use. But you call it on the button you want to remove.

But we need to see code.

Remember to use the code button which is the number sign/pound sign in the toolbar above.

Mark
__________________
Perfect World Programming LLC
http://www.perfectworldprogramming.com

Please check out my apps.

TubeOrganizer
http://www.spritzlerapps.com/tube-organizer.html

Paper Clips
http://spritzlerapps.weebly.com/paper-clips.html
bytor99999 is offline   Reply With Quote
Old 08-14-2010, 04:51 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 72
santosh_kumar is on a distinguished road
Default

Quote:
Originally Posted by bytor99999 View Post
Please post your code so we can see where you went wrong. removeFromSuperview should be the best to use. But you call it on the button you want to remove.

But we need to see code.

Remember to use the code button which is the number sign/pound sign in the toolbar above.

Mark
CODE:

- (IBAction)actionid)sender
{

NSLog(@"Segment %d selected", [sender selectedSegmentIndex]);

iRemoveSubview1 *subview1=[[iRemoveSubview1 alloc] initWithFrame:CGRectMake(11,100,111,222)];
iRemoveSubview2 *subview2=[[iRemoveSubview2 alloc] initWithFrame:CGRectMake(11,100,111,222)];

if ([sender selectedSegmentIndex]==0)
{
[self addSubview:subview1];
//[subview1 removeFromSuperview]; if not commented, subview will be removed

}

if ([sender selectedSegmentIndex]==1)
{
NSLog(@"inside textfield...if");
[subview1 removeFromSuperview];// subview1 is not removed
[self addSubview:subview2]; // subview1 and subview2 both are overlapped

}


}
santosh_kumar is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone & ipod touch apps

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
5 members and 338 guests
bignoggins, Chickenrig, givensur, linkmx, PlutoPrime
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,894
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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