Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9055395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:56:39+00:00 2026-06-16T13:56:39+00:00

I was wondering if someone could explain this to me. I’m building a universal

  • 0

I was wondering if someone could explain this to me. I’m building a universal app using storyboards. The iPhone version has a navigation controller with a master list view and then a sub-list view (both are tableview controllers.

The iPad app uses a split view controller to achieve the same thing as the iphone (a master list, with a detail list). All is good, however when using the “replace” segue to transition to a new detail view on the split view controller I have to embed the new detail views within their own navigation controller, whereas I don’t need to do this on the iphone (it’s already within a navigation controller. (Hopefully this makes some sense)

My code (which works) ends up looking like so:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    NotesListViewController *listNotesView;
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
        listNotesView = [[segue destinationViewController] topViewController];
    } else {
        listNotesView = [segue destinationViewController];
    }

    if ([segue.identifier isEqualToString:@"NotesByDate"]) {
        [listNotesView setGroupType:@"date"];
    } else if ([segue.identifier isEqualToString:@"NotesByTopic"]) {
        [listNotesView setGroupType:@"topics"];
    } else if ([segue.identifier isEqualToString:@"NotesBySpeaker"]) {
        [listNotesView setGroupType:@"speaker"];
    }

So… The issue is that the first condition of the IF statement is generating a warning (incompatible pointer type assigning to NoteListViewController from UIViewController). However, it isn’t a UIViewController, it’s a UITableViewController. On the iPhone version it WOULD be a UIView, but I’m specifically checking for iPad here.

Like I said, it works, so maybe this isn’t really an issue, but I’m a bit annoyed by the warning constantly appearing and being unsure of how/if I can fix it.

I’ll try to post images of the storyboards in a bit, hopefully that helps explain this some.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:56:41+00:00Added an answer on June 16, 2026 at 1:56 pm

    All you have to do is typecast the UIViewController you retrieve with [[segue destinationViewController] topViewController] to a NotesListViewController.

    So, you would have listNotesView = (NotesListViewController *)[[segue destinationViewController] topViewController];

    As an aside, the reason your code works but generates a warning is because regardless of what type you call an object, the actual type that is pointed to in memory is what matters(You can declare something as an NSString and allocate the memory with [NSDictionary alloc], but that would just lead to confusion). -topViewController returns a UIViewController object because somewhere along the line, any class it returns will inherit from UIViewController, like your NotesListViewController does, but it doesn’t have enough information to be any more specific than that, so you have to give the compiler the extra information by typecasting the object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if someone could explain this to me: In [400]: poz0='' In
Yes this is homework. I was wondering if someone could explain the process of
I am wondering if someone could explain this line of code of DB2 in
i was just wondering if someone could explain this code for me so i
Wondering if someone with experience could possibly explain this a bit more. I have
I ran across this and was wondering if someone could explain why this works
I saw this tip in another question and was wondering if someone could explain
Just wondering if someone could explain this to me? I have a program that
i'm new to obj-c and i was just wondering if someone could explain this.
I was wondering if someone could explain to me how to make a simple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.