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
  • 相关阅读:
    非冒泡事件的冒泡支持
    js--题目二
    js-- 一些题目
    jQuery 请指出'$'和'$.fn'的区别?或者说出'$.fn'的用途。
    jQuery 请指出'.bind()','.live()'和'.delegate()'的区别
    什么时候不能完全按照设计稿来
    edm注意细节
    响应式设计
    css -- 题目汇总
    什么是Handler(四)
  • 原文地址:https://www.cnblogs.com/ygm900/p/3099261.html
Copyright © 2011-2022 走看看