iphone sdk-调用视图的superview的viewcontroller方法 [英] iphone sdk - calling a method of view's superview's viewcontroller

查看:44
本文介绍了iphone sdk-调用视图的superview的viewcontroller方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我如何在当前视图中调用该方法,该方法是在当前视图的超级视图的viewcontroller中实现的?你能帮我吗.谢谢

hello how can i call in the current view, a method implemented in the viewcontroller of the current view's superview? can you help me please. thanx

推荐答案

您可以添加函数-(void)initWithView:(EchiquierDisplayView *)aSuperview或类似的东西,在您的

You can add a function -(void)initWithView:(EchiquierDisplayView *)aSuperview or something like that, define a reference in your

@interface pieceDraggableImageView : UIImageView { 
CGPoint startLocation; 
CGPoint startLocationInView;
EchiquierDisplayView *theSuperview;  
} 

@property (nonatomic, retain) EchiquierDisplayView *theSuperview;

-(void)correctDestinationPosition; 
-(void)initWithView:(EchiquierDisplayView *)aSuperview; 
...
-(void)askSuperview;
@end

@implementation pieceDraggableImageView

...
-(void)initWithView:(EchiquierDisplayView *)aSuperview
{
   theSuperview = aSuperview;
}
...
-(void) correctDestinationPosition
{
   [theSuperview correctIt];
}

现在请确保在您的超级视图中实现正确的功能.希望我能正确理解你的问题...

Now be sure to implement the function correctIt in your superview. Hopefully i understood your question right...

这篇关于iphone sdk-调用视图的superview的viewcontroller方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆