A request to represent a member in something other than a structure or association

I have this error when I create my iphone application: a request to represent a member in an unstructured or union on [CommuneSlider.view removeFromSuperview];

code: - (void) CommuneSelected {

CommuneDetailsViewController *com = [[CommuneDetailsViewController alloc] initWithNibName:@"CommuneDetailsViewController" bundle:nil]; UINavigationController *navig = [[UINavigationController alloc] initWithRootViewController:com]; [self setCommuneDetails:(CommuneDetailsViewController *) navig]; [navig setNavigationBarHidden:YES]; [com release]; [navig release]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:.8]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:window cache:YES]; [CommuneSlider.view removeFromSuperview]; [self.window addSubview:[CommuneDetails view]]; [UIView commitAnimations]; 

}

help is needed

+4
source share
3 answers

ok this is AzurGuideAppDelegate.h:

 @class CommuneSliderController, AccueilViewController,CommuneDetailsViewController; @interface AzurGuideAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; AccueilViewController *AccueilController; CommuneSliderController *CommuneSlider; CommuneDetailsViewController *CommuneDetails; UINavigationController *navigationControl; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet AccueilViewController *AccueilController; @property (nonatomic, retain) IBOutlet CommuneSliderController *CommuneSlider; @property (nonatomic, retain) IBOutlet CommuneDetailsViewController *CommuneDetails; - (void) goBack; - (void) goFront; - (void) CommuneSelected; @end 

and here is AzurGuideAppDelegate.m, where I defined my method:

 #import "AzurGuideAppDelegate.h" #import "AccueilViewController.h" @implementation AzurGuideAppDelegate @synthesize window; @synthesize AccueilController; @synthesize CommuneSlider; @synthesize CommuneDetails; - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after application launch [window addSubview:AccueilController.view]; [window makeKeyAndVisible]; } - (void) CommuneSelected { CommuneDetailsViewController *com = [[CommuneDetailsViewController alloc] initWithNibName:@"CommuneDetailsViewController" bundle:nil]; UINavigationController *navig = [[UINavigationController alloc] initWithRootViewController:com]; [self setCommuneDetails:(CommuneDetailsViewController *) navig]; [navig setNavigationBarHidden:YES]; [com release]; [navig release]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:.8]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:window cache:YES]; [CommuneSlider.view removeFromSuperview]; [self.window addSubview:[CommuneDetails view]]; [UIView commitAnimations]; } 

and my CommuneSliderController class:

 #import "AzurGuideAppDelegate.h" #import "CommuneSliderController.h" #import "CoverFlowView.h" #import "CoverViewController.h" #define CVC_VIEW_TAG 999 @implementation CommuneSliderController - (IBAction) goFront:(id) sender { AzurGuideAppDelegate *main = (AzurGuideAppDelegate *)[[UIApplication sharedApplication] delegate]; [main goFront]; } // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Custom initialization } return self; } // Implement loadView to create a view hierarchy programmatically, without using a nib. - (void)loadView { UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; contentView.backgroundColor = [UIColor whiteColor]; self.view = contentView; [contentView release]; [[UIApplication sharedApplication] setStatusBarHidden:YES]; CoverViewController *cvc = [[CoverViewController alloc] init]; cvc.view.tag = CVC_VIEW_TAG; [self.view addSubview:cvc.view]; } 
+1
source

If this is an error string:

a request to represent a member in something other than a structure or union on [CommuneSlider.view removeFromSuperview];

It appears that CommuneSlider does not have a "view" member. The variable name makes me think that this is UIControl, not a subclass of UIViewController (which will have a view property).

Are you sure you don't want something like:

 [CommuneSliderController.view removeFromSuperview]; 
+1
source

If it were C ++, I would say "there is a pointer to the class, and you are trying to say pClass.foo instead of pClass->foo " or the type whose variable " view " you are trying to access is unknown for some reason. Perhaps this can help with Objective-C.

0
source

Source: https://habr.com/ru/post/1312874/


All Articles