• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
iOS - Designing a view controller with multiple views
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iOS - Designing a view controller with multiple views


  • Subject: iOS - Designing a view controller with multiple views
  • From: James West <email@hidden>
  • Date: Mon, 16 Jan 2012 11:38:05 -0600

I have a class design issue I was hoping someone could help me out with.

I'm currently developing an iOS app that relies heavily on a remote API for all of its data. Most data is requested in viewDidLoad.

The availability and format of data can change, and in response to that I need to implement three different designs depending on how much data I have access to: the normal design, a data not found design and a partial data design. I'm trying to declare as much as possible in xib files.

Right now I have one 'master' view controller, which when all things go according to plan, presents a view for all of the data. In cases where the data is not available, it instantiates an "inner view" controller and assigns its view to self.view:


    if ([analysis length] == 0) {


        hasReview = NO;


        UnreviewedSPP* unreviewedSPPView = [[UnreviewedSPP alloc] init];


        unreviewedSPPView.ProductName = self.productName;


        unreviewedSPPView.SdcId = self.sdcId;


        unreviewedSPPView.Delegate = self;


        NSArray* newViews = [[NSBundle mainBundle] loadNibNamed:@"UnreviewedSPP" owner:unreviewedSPPView options:nil];


        self.view = [newViews objectAtIndex:0];


        return;


    }



This works pretty well, except for that fact that I cannot seem to push any new views onto the navigationController stack from the inner view (using a custom button that can execute a block):


        [priceButton handleControlEvent:UIControlEventTouchUpInside withBlock:^{


            WebViewController* wv = [[[WebViewController alloc] initWithNibName:@"WebViewController" bundle:nil] autorelease];


            wv.url = offerURL;


            [Delegate performSelector:@selector(pushViewControllerFromSubview:) withObject:wv];


        }];



I've tried using a delegate pattern as well as assigning the outer view controller's navigationcontroller as a property to the inner view. Neither works.

This whole thing feels rather hackish, and I'm sure there's something by design in the framework that stops this. Any thoughts?

--
James West
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: iOS - Designing a view controller with multiple views
      • From: Evadne Wu <email@hidden>
  • Prev by Date: Re: KVO willChange and didChange
  • Next by Date: Re: iOS - Designing a view controller with multiple views
  • Previous by thread: Re: KVO willChange and didChange
  • Next by thread: Re: iOS - Designing a view controller with multiple views
  • Index(es):
    • Date
    • Thread