2012-05-24 2 views
3

iPhone 응용 프로그램에서 전역 int 변수를 만들지 만 오류가 발생합니다.iPhone 응용 프로그램에서 전역 int 선언하는 방법

나는 이런 식으로 선언하고있다 :

AppDelegate.h 

int maxglobal; 

나는 이것이이 객체가 다른 클래스의 속성을 설정할 수 없습니다 말을 다른 값에 할당합니다.

답변

0

목표 - C :

@property (assign) int maxglobal; // define this in app delegate 

C : 당신의 .H 파일에서

int maxglobal; // define this outside any class and it's "global" 
0

double GlobalVariable=0.0;

당신이 @synthesize하고 이상이 작업을 수행주의해야 할 완료되었습니다.

+0

로 변수를 선언하는 통근 키워드를 사용할 수 있습니다! – Maulik

0

는 다음을 시도해보십시오

AppDelegate.h: 
@interface AppDelegate{ 
    int maxglobal; 
} 
@property (nonatomic, readonly) int maxglobal; 

AppDelegate.m 
@implementation AppDelegate 
@synthesize maxglobal; 
0

당신은 또한 문제는 int` 두 번하지`에 관한

글로벌
extern int maxglobal; 
관련 문제