Reputation: 1742
I'm having problem accessing the usual properties like frame, bounds, origin, size, etc etc. Within my subclassed UIView, I'm trying to edit the frame/bounds when the user presses something.
I keep getting this error 'frame' undeclared (first use in this function).
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];
}
}
}
Upvotes: 0
Views: 176
Reputation: 764
self.frame is working with Xcode 3.2.3 (remember is case-sensitive)
self.view doesn't exist in UIView (it exists in UIViewController), so self.view.frame won't work.
Try [self frame] instead.
Upvotes: 1