If I create the BNRHypnosisView class (Cocoa Touch) as a UIView subclass with the requested CGRect “frame” property, all rectangles are drawn at the left-top of the screen instead of the x and y which are set using CGRectMake().
CGRect firstFrame = CGRectMake(160, 240, 100, 150); BNRHypnosisView *firstView = [[BNRHypnosisView alloc] initWithFrame: firstFrame]; firstView.backgroundColor = [UIColor redColor]; [self.window addSubview: firstView];
However, if I do this using a direct UIView instance, things work as they should.
CGRect testFrame = CGRectMake(300, 300, 10, 10); UIView *testView = [[UIView alloc] initWithFrame: testFrame]; testView.backgroundColor = [UIColor blackColor]; [self.window addSubview];
I am using XCode 5.1.1 on Mac OS 10.9.3.
What could be going wrong?