2010-08-06 133 views
0

我遇到了像框架,边界,起源,大小等常见的属性问题等。在我的子类UIView,我试图编辑框架/界限时,用户按下的东西。如何访问子类UIView的属性?

我不断收到此错误'框架'未申报(首次使用此功能)。

EyeView.h

#import <UIKit/UIKit.h> 

@interface EyeView : UIView { 
    CGFloat minWidth; 
    CGFloat minHeight; 
    bool touchInWindow, touchTopLeft, touchTop, touchTopRight, touchLeft, touchRight, touchBottomLeft, touchBottom, touchBottomRight; 
    bool dragging; 
} 

@property CGFloat minWidth; 
@property CGFloat minHeight; 

- (void)checkTouchedWhere:(NSSet *)touches; 

@end 

EyeView.m

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ 
    if (touches.count == 1){ 
     if (dragging == TRUE){ 
       CGPoint prevPoint1 = [[[touches allObjects] objectAtIndex:0] previousLocationInView:self]; 
       CGPoint currPoint1 = [[[touches allObjects] objectAtIndex:0] locationInView:self]; 
      CGFloat differencex = currPoint1.x - prevPoint1.x; 
      CGFloat differencey = currPoint1.y - prevPoint1.y; 
      frame.origin.x += differencex; 
      frame.origin.y += differencey; 
      [self setNeedsDisplay]; 

     } 
    } 
} 
+0

如果你想得到答案,你必须分享一些代码。 – mvds 2010-08-06 13:36:31

+0

Self.frame/self.view.frame也不起作用.. – 2010-08-06 13:37:39

+0

向我们展示了有问题的代码。 – SteamTrout 2010-08-06 13:58:59

回答

1

self.frame与Xcode的3.2.3工作(记住的是区分大小写)

self.view没有按” t存在于UIView中(它存在于UIViewController中),所以self.view.frame将不起作用。

尝试[self frame]代替。