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 11-24-2011, 12:37 AM   #1 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 34
jmktayag is on a distinguished road
Default UITableview won't show from modalView

Hi guys,

I have a tableview in a view which doesn't show when I use a modal view to push the view but if I add the view as a subview the tableview shows. What is my problem here? I really need your help guys.
jmktayag is offline   Reply With Quote
Old 11-24-2011, 01:29 AM   #2 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

Post code please.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 11-24-2011, 01:38 AM   #3 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 34
jmktayag is on a distinguished road
Default

Quote:
Originally Posted by Domele View Post
Post code please.
Here is my code from myView which is inside a touch event

PHP Code:
ViewAccountController *postViewController = [[ViewAccountController allocinit];
    
    
postViewController.modalPresentationStyle UIModalPresentationPageSheet;
    [
postViewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
    [
self presentModalViewController:postViewController animated:YES];
    
postViewController.view.superview.frame CGRectMake(00600450);
    
postViewController.view.superview.center self.view.center;
    
    [
postViewController release]; 
and the view which is supposed to shown

PHP Code:
@interface ViewAccountController UIViewController<UITableViewDataSourceUITableViewDelegate>{
    
UITableView *contactsTbl;
}

@
property(nonatomicretainIBOutlet UITableView *contactsTbl;

@
end 
I have properly connected the tableview in IB.It's just a simple modalview which I can't get to run. I really don't know where I went wrong.
jmktayag is offline   Reply With Quote
Old 11-24-2011, 01:59 AM   #4 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

I don't know how or why it would cause it but try removing your postViewController.view.superview calls. I just have a hunch. And either way your superview.center call is redundant.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 11-24-2011, 02:15 AM   #5 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 34
jmktayag is on a distinguished road
Default

Quote:
Originally Posted by Domele View Post
I don't know how or why it would cause it but try removing your postViewController.view.superview calls. I just have a hunch. And either way your superview.center call is redundant.
if I remove the superview it will only remove the backgroundview and still the table doesn't show. when I tried to resize the table to the whole view it shows the table but when i want to return it to its original size, again the table doesn't show. see the image i have attached what happens to the table after I resized it.

Thanks,
Attached Images
File Type: jpg tableresized.jpg (7.0 KB, 7 views)
jmktayag is offline   Reply With Quote
Old 11-24-2011, 02:19 AM   #6 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 34
jmktayag is on a distinguished road
Default

I have also attached what my design in interface builder. hope this helps.
Attached Images
File Type: jpg mustShow.jpg (11.1 KB, 6 views)
jmktayag is offline   Reply With Quote
Old 11-24-2011, 02:23 AM   #7 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

Oh... That's not how modal view controllers are supposed to work. Modal view controllers are meant to take up the whole screen. (Edit: The only time it shouldn't take up the whole screen is when you are presenting as a page sheet and a form sheet on iPad, even then it's basically the whole screen.) If you are targeting iOS 5+, use addChildViewController:. If you are targeting under that, you'll have to just manage the controllers yourself and use addSubview.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.

Last edited by Domele; 11-25-2011 at 11:19 AM.
Domele is offline   Reply With Quote
Old 11-24-2011, 02:29 AM   #8 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 34
jmktayag is on a distinguished road
Default

Can you further discuss how to use addChildViewController? Can I also present it in a modal view?
jmktayag is offline   Reply With Quote
Old 11-24-2011, 02:34 AM   #9 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

I can't explain it since I haven't used it myself yet and there doesn't seem to be any tutorials online. I think you just call it like you would presentModal...
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 11-24-2011, 02:44 AM   #10 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 34
jmktayag is on a distinguished road
Default

Ok. I think I'll just need to give it a try. Thanks man! I appreciate it!
jmktayag is offline   Reply With Quote
Old 11-25-2011, 06:15 PM   #11 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by jmktayag View Post
Can you further discuss how to use addChildViewController? Can I also present it in a modal view?
I've done a project using child view controllers. It's cool. The introduction to the UIViewController class has a pretty good discussion of the new container view controller feature of iOS 5. That's all I needed in order to make it work, and I got it working the first time, without having to fiddle with it. I found it clean and easy to use.

In iOS 5, a view controller can manage one or more child view controllers, who's content view(s) become subviews of their parent view controller.

The addChildViewController call tells the parent view controller about the child view controller. You add all the child view controllers that the parent will ever manage, before ever displaying any of them. That method doesn't actually do anything visible.

Once you add a view controller as a child view controller, you can install the child view controller's content view as a subview of the parent view controller.

The method transitionFromViewController:toViewController:dura tionptions:animations:completion: is the workhorse method that lets you switch child view controllers. That method lets you build your own parent view controller that acts like a navigation controller, tab controller, or create a novel type of container controller.

What I did was to set up a parent view controller that had subviews that were laid out to contain child view controllers. I created a tab bar like view that went across the bottom. Above that was a view to hold a "content view". I wrote a method showContentViewAtIndex:withTransition: that took an index to a child view controller and swaps it into place with one of several transitions. That method was very easy to write using the new transitionFromViewController:toViewController:dura tionptions:animations:completion: method.

There's also a method automaticallyForwardAppearanceAndRotationMethodsTo ChildViewControllers, that if you make it return TRUE, causes the system to forward rotation and other appearance changes to child view controllers.

It shouldn't be too hard to create a custom modal view controller facility in your app's view controllers. You'd create a new parent class for "normal" view controllers, and have it accept a view controller that you wanted to display modally and make it a child. You could then implement a modal transition. You would need to add a partly transparent overlay over the rest of the view controller's content to prevent the user from clicking on something until dismissing the "modal" view controller.

The code I wrote is under NDA, and tightly entwined with that project, so I can't really share it.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is online now   Reply With Quote
Old 11-27-2011, 07:46 PM   #12 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 34
jmktayag is on a distinguished road
Default

Thanks man! I'm really learning a lot. I'm gonna try it now! Excited!
jmktayag 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: 398
16 members and 382 guests
chiataytuday, Clouds, David-T, dedeys78, Duncan C, e2applets, EvilElf, iekei, ipodphone, leostc, LunarMoon, Murphy, QuantumDoja, sacha1996, Sami Gh, teebee74
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,125
Posts: 402,910
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

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