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

  • Home
  • SEARCH
  • 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 7929043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:56:32+00:00 2026-06-03T19:56:32+00:00

I have subclass of UIViewController called FullScreenViewController which has a property of type ImageScrollView

  • 0

I have subclass of UIViewController called FullScreenViewController which has a property of type ImageScrollView which is subclassed UIScrollView object. The implementation and interface look as follows:

FullScreenViewController.h

#import <UIKit/UIKit.h>

@class ImageScrollView;

@interface FullScreenViewController : UIViewController 
{
    ImageScrollView *_scrollView;

}

@property(nonatomic, retain) ImageScrollView *scrollView;

@end

FullScreenViewController.m

#import "FullScreenViewController.h"
#import "ImageScrollView.h"

@implementation FullScreenViewController

@synthesize scrollView = _scrollView;
...
@end

now I subclass FullScreenViewController, and I try to access any properties from the ImageScrollView property and I keep getting the error message: “Property cannot be found”. When I add ImageScrollView.h to the subclass, it works, but I’m not understanding this. I’ve already added ImageScrollView.h in FullScreenViewController, why should I have to add it again?

UPDATE: Rather than using a forward class declaration, I’ve included ImageScrollView.h in FullScreenViewController.h. I’m a little confused as to why I’ve ever use a forward declaration versus just including the .h file?

  • 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-03T19:56:34+00:00Added an answer on June 3, 2026 at 7:56 pm

    Given the header:

    @interface FullScreenViewController : UIViewController 
    {
        ImageScrollView *_scrollView;
    
    }
    
    @property(nonatomic, retain) ImageScrollView *scrollView;
    
    @end
    

    a forward declaration @class ImageScrollView is all that’s needed. This tells the compiler that there is an objc class named ImageScrollView.

    Of course, with a forward declaration, the interface is not visible where you need to use it unless you also #import ImageScrollView where you use it.

    now I subclass FullScreenViewController, and I try to access any properties from the ImageScrollView property and I keep getting the error message: “Property cannot be found”. When I add ImageScrollView.h to the subclass, it works, but I’m not understanding this. I’ve already added ImageScrollView.h in FullScreenViewController, why should I have to add it again?

    ImageScrollView‘s declaration is not visible to the subclass FullScreenViewControllerSubclass. ImageScrollView.h is visible only where #imported. FullScreenViewController.m is not visible to FullScreenViewControllerSubclass.m. Therefore, you must write another #import in FullScreenViewControllerSubclass.m to use ImageScrollView there.

    UPDATE: Rather than using a forward class declaration, I’ve included ImageScrollView.h in FullScreenViewController.h. I’m a little confused as to why I’ve ever use a forward declaration versus just including the .h file?

    Use forwards for fast build times and sane, controlled dependency structures. This is a very time consuming problem to undo. And this problem gets much worse as the size of your programs and libraries increase:

    Would you prefer a change to a header in a medium sized project to require recompilation of 50 sources with an average preprocessed input of 150,000 lines per translation, or would you favor that change to affect 6 sources with an average preprocessed input of 40,000 lines per translation? The difference here is that small change takes the incremental rebuild from seconds to minutes to complete, depending on how you have structured your dependencies and imports.

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

Sidebar

Related Questions

I have a UIViewController subclass which has the view property set to a UIScrollView
So I have a UIViewController subclass called MyTabBarViewController that has a UIScrollView. Inside of
I have a UIViewController subclass called TripViewController. This class has the following method: -
I have a superclass of UIViewController - MasterViewController which declares a property called itemsViewController
I have written a subclass of UIViewController which creates a view programmatically, instead of
I have a custom UIViewController subclass, which gets pushed on a UINavigationController stack. I
I have a very simple subclass of UIViewController : @interface RoastChickenViewController : UIViewController {
I have a subclass of UIViewController with an NSMutableArray as a property to use
I have a subclass of UIViewController which handles a UIView. The viewcontroller is presented
I have a root UIViewController subclass that has a UITabBar, (I'm not using UITabBarController)

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.