"x"、 "y" "object"を渡して移動させる一般的なメソッドを記述しようとしています。私はそのようにようにそれを呼びたいButtonオブジェクトをメソッドに渡す
-(void) changeObjectLocations: (integer_t) xSpot: (integer_t) ySpot: (id) sender {
if (![sender isKindOfClass:[UIButton class]])
{
UIButton *myObject = (UIButton *)sender;
[UIView animateWithDuration:1.5
animations:^{
CGRect newFrame = myObject.frame;
newFrame.origin.x = xSpot;
newFrame.origin.y = ySpot;
myObject.frame = newFrame;
}];
}
else if (![sender isKindOfClass:[UILabel class]])
{
UILabel *myObject = (UILabel *)sender;
[UIView animateWithDuration:1.5 animations:^{
CGRect newFrame = myObject.frame;
newFrame.origin.x = xSpot;
newFrame.origin.y = ySpot;
myObject.frame = newFrame;
}];
}
}
:
-(void) orientationBlockLandscape {
[self changeObjectLocations: 456 :282 : btn1] ;
[self changeObjectLocations: 391 :227 : lblTitle] ;
}
それはコンパイルに、取り組んでいるが、私は次の警告を得る:
SecondViewController.m:33現在、私はこれを持っています:警告: 'SecondViewController'が '-changeObjectLocations :::'に応答しない可能性があります
オブジェクトを渡すことができますか?すべてのヘルプに事前に感謝します。あなたはSecondViewControllerのヘッダーにchangeObjectLocations
を定義していないよう
ジオ...
出力する警告に基づいて
それでした。私はいつも何かを忘れるので、Objective-Cの初心者です!ありがとう – George
@問題ありません。途中で素晴らしい名前! ;) –