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-16-2010, 10:37 AM   #1 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 920
spiderguy84 is on a distinguished road
Default SegmentedControl to change WebViews

I want about 3 different blog pages on one tab of my tab bar application. I'd like to have the segmentedcontrol setup to handle this. So far, I have made 3 different view classes, each with a webview that points to a different blog. On the FirstTabViewController I declared the class of all 3 views and set up an IBOutlet for each one. I also declared the IBOutlet for the segmentedcontrol, and hooked up all connections in IB. In the .m file I am running this code:
Code:
- (IBAction)changesegment {
	if (segment.selectedSegmentIndex == 0) {
		[self addSubview: blog1];
	}
	if (segment.selectedSegmentIndex == 1) {
		[self addSubview: blog2];
	}
	if (segment.selectedSegmentIndex == 2) {
		[self addSubview: blog3];
	}
}
But, I can't get it to work. Any ideas?
__________________
My latest app...i Miss Mommy
spiderguy84 is offline   Reply With Quote
Old 09-16-2010, 01:20 PM   #2 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 50
o2fill is on a distinguished road
Default

Hi,

The problem is that you are trying to add a subview to a view controller. You need to add it to its view. Try: [self.view addSubview:blogx]; instead.

Also, you might need to remove the previous subView ([theView removeFromSuperview] when you switch otherwise you'll have issues when you add the same subView over and over in the stack.

Good luck.
o2fill 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: 319
16 members and 303 guests
2ndSegment, cayladv57, cgokey, dermotos, djohnson, Domele, Hamad, heshiming, linkmx, markuschow, pungs, Rudy, Sloshmonster, teebee74, 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 10:57 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0