내가 어떤 목적-C 코드를 쓰고 있어요 그리고 난이 작동하지 않는 이유를 알아낼 수 없습니다에서 호환되지 않는 유형 :오류 : 할당
buttonRect = CGRectMake(0,0,100.0,100.0);//error:incompatible types in assignment
CGRect newFrame = CGRectInset(buttonRect, -0.2, -0.2);//error:incompatible type for argument 1 of CGRectInset
button.frame = newFrame;
buttonRect이 CGRect 내 클래스의 인스턴스 변수로 정의됩니다, 및 단추는 또한 인스턴스 변수로 정의 된 UIButton입니다. 왜 이것이 작동하지 않습니까? 내 헤더 파일 :
//
// MyViewController.h
// HelloWorld
//
// Created by RCIX on 7/10/09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MyViewController : UIViewController {
UITextField *textField;
UILabel *label;
NSString *string;
UIButton *button;
CGRect *buttonRect;
}
@property (nonatomic, assign) CGRect *buttonRect;
@property (nonatomic, retain) IBOutlet UITextField *textField;
@property (nonatomic, retain) IBOutlet UILabel *label;
@property (nonatomic, retain) IBOutlet UIButton *button;
@property (nonatomic, retain) NSString *string;
- (IBAction)helloButtonDown:(id)sender;
- (IBAction)helloButtonUp:(id)sender;
@end
buttonRect의 선언을 복사하여 붙여 넣습니다. – Chuck