zoukankan      html  css  js  c++  java
  • 让人痛恨的xcode错误提示信息! 以及为什么不能将A.h文件 在B.h文件#import 而只能在B.m文件中#import呢?

    在调试程序时,遇到如下两条信息:

    Expected identifier

    Expected ';' after method prototype

    原因:A.h文件  在B.h文件#import 导致A.h文件报出如上错误提示,只要将声明文件写在B.m文件中即可解决上述问题。为什么?

    B.h  文件

    #import <UIKit/UIKit.h>
    @interface WelcomeViewController : UIViewController
    
    @end

    B.m文件

    #import "WelcomeViewController.h"
    #import <QuartzCore/QuartzCore.h>
    #import "IndexViewController.h"
    #import "InterfaceHelper.h"     //要引入的那个.h文件
    
    #define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
    
    @interface WelcomeViewController ()
    
    @end
    
    @implementation WelcomeViewController
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
        
    
        [self performSelector:@selector(GoToViewController) withObject:nil afterDelay:1]; //1秒后,进入应用程序的主界面
        
        [InterfaceHelper initInterfaceHelper];
        NSUserDefaults *configData = [NSUserDefaults standardUserDefaults];
        NSLog(@"%@",[configData objectForKey:@"initStart"]);
    
    }
    
    -(void)GoToViewController
    {
        CATransition *animation = [CATransition animation];
        animation.delegate = self;
        animation.duration = 0.7 ;  // 动画持续时间(秒)
        animation.timingFunction = UIViewAnimationCurveEaseInOut;
        animation.type = kCATransitionFade;//淡入淡出效果
        [[self.view layer]addAnimation:animation forKey:@"animation"];
        
    //    MainViewController *myMainViewController = [[MainViewController alloc]initWithNibName:@"MainViewController" bundle:nil];
    //    [self.view addSubview:myMainViewController.view];
        
        if (iPhone5) {
           IndexViewController *myIndexViewController = [[IndexViewController alloc]initWithNibName:@"IndexViewController_ip5" bundle:nil];
            [self.view addSubview:myIndexViewController.view];
        }else{
           IndexViewController *myIndexViewController = [[IndexViewController alloc]initWithNibName:@"IndexViewController" bundle:nil];
            [self.view addSubview:myIndexViewController.view];
        }
    }
    
    - (void)viewDidUnload
    {
        [super viewDidUnload];
        // Release any retained subviews of the main view.
    }
    
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
    //    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
        return NO;
    }
    
    @end
  • 相关阅读:
    118/119. Pascal's Triangle/II
    160. Intersection of Two Linked Lists
    168. Excel Sheet Column Title
    167. Two Sum II
    172. Factorial Trailing Zeroes
    169. Majority Element
    189. Rotate Array
    202. Happy Number
    204. Count Primes
    MVC之Model元数据
  • 原文地址:https://www.cnblogs.com/ygm900/p/3099261.html
Copyright © 2011-2022 走看看