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 05-07-2009, 04:27 PM   #1 (permalink)
New Member
 
Join Date: May 2009
Posts: 4
epiceric is on a distinguished road
Default Best way to show/hide a view

Hi,

I have a login screen which appears when my app starts up, and it has a login form. After the user submits the form (by pressing a button), I have a view that I bring to the front which contains a UIActivityIndicatorView and a label.

My problem is with the Indicator and the label, which do not seem to be the contents of the view that I'm bringing to the front. I added them as subviews in IB (meaning, I dragged them into the view), but they remain on top whether I bring their superview to front or back.

How can I get the subviews to follow their superview in the layout order?

I'd appreciate if anyone can bring some light to this, and if there is a need for code (which this seems basic and general enough to not need it) then I can supply it.

An aside:
I'm a web developer, so I'm trying to create an analogy between <div> elements in webpages and the UIView objects. Furthermore, I'm trying to replicate the behavior of divs when using display:none.
epiceric is offline   Reply With Quote
Old 05-07-2009, 04:29 PM   #2 (permalink)
jsd
at this moment
 
Join Date: Mar 2009
Location: San Francisco, CA
Posts: 900
jsd is on a distinguished road
Default

Quote:
Originally Posted by epiceric View Post
Hi,

I have a login screen which appears when my app starts up, and it has a login form. After the user submits the form (by pressing a button), I have a view that I bring to the front which contains a UIActivityIndicatorView and a label.

My problem is with the Indicator and the label, which do not seem to be the contents of the view that I'm bringing to the front. I added them as subviews in IB (meaning, I dragged them into the view), but they remain on top whether I bring their superview to front or back.

How can I get the subviews to follow their superview in the layout order?

I'd appreciate if anyone can bring some light to this, and if there is a need for code (which this seems basic and general enough to not need it) then I can supply it.

An aside:
I'm a web developer, so I'm trying to create an analogy between <div> elements in webpages and the UIView objects. Furthermore, I'm trying to replicate the behavior of divs when using display:none.
are the label and activity on the same view as the rest of the login form? if so you will need to create another view to contain them. you should then be able to move the container view backwards and forwards.

you could hook the container view up to your code with an IBOutlet and then use [containerView removeFromSuperview] and [self.view addSubview:containerView] to get it off and on the screen.
jsd is offline   Reply With Quote
Old 05-07-2009, 05:01 PM   #3 (permalink)
New Member
 
Join Date: May 2009
Posts: 4
epiceric is on a distinguished road
Default

Quote:
Originally Posted by jsd View Post
are the label and activity on the same view as the rest of the login form? if so you will need to create another view to contain them. you should then be able to move the container view backwards and forwards.

you could hook the container view up to your code with an IBOutlet and then use [containerView removeFromSuperview] and [self.view addSubview:containerView] to get it off and on the screen.
Thanks jsd.

I appreciate your quick response.

Quote:
are the label and activity on the same view as the rest of the login form?
Yes, I had them together under my 'loadingView' which I created in IB, and created an outlet for in XCode (same as your suggestion).

I realized moving them back/forward was not really what I needed in this case. Also, adding as subview wasn't working since my loadingView was already a subview of the container class.

In this case I ended up using IB to start the loading view off as hidden (it worked for hiding the subviews, too), then in my button's action method I used:
Code:
loadingView.hidden = NO;
and this worked to show it.

Maybe what would make more sense is to not have the loading view as a subview to start out (this is a result of not being well-versed with IB), but to create a subclass of UIView to use as a general loading indicator class, and add it whenever needed with addSubview:.

I'll try that out later when I refactor, and update this post accordingly.
epiceric 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: 318
7 members and 311 guests
givensur, guusleijsten, jbro, mer10, n00b, SLIC, yomo710
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,113
Posts: 402,880
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

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