私はいくつかのObjective-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