我有一个UIView,我设置为响应捏手势并改变它的大小,除了,一旦你放大它然后尝试再次捏它,它跳到它的原始大小(恰好是100x200).这是代码:
@implementation ChartAxisView
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
// do gesture recognizers
UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(onPinch:)];
[self addGestureRecognizer:pinch];
[pinch release];
}
return self;
}
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGColorRef redColor = [UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:1.0].CGColor;
CGContextSetFillColorWithColor(context, redColor);
CGContextFillRect(context, self.bounds);
}
- (void)onPinch: (UIPinchGestureRecognizer*) gesture {
self.transform = CGAffineTransformMakeScale(gesture.scale, gesture.scale);
}
- (void)dealloc {
[super dealloc];
}
@end
Run Code Online (Sandbox Code Playgroud)
有什么想法吗?
我很难理解ZeroMQ消息系统,所以在我潜入之前,我想知道是否有人知道我想做什么甚至是可能的.
我想设置一个带有ZeroMQ的pubsub服务器,它将发布某些数据流并订阅其中一些流,用户必须进行身份验证才能看到他们是否可以访问这些流.我见过的所有内容都使用zmq.SUBSCRIBE命令进行订阅.
可以修改以进行身份验证吗?是否支持开箱即用?