मुझे UIButtons
का उपयोग करके एक अजीब समस्या है, custom
टाइप करें। मैं UIScrollview
पर उन बटनों में से 4 को रख रहा हूं, प्रत्येक बटन को CGAffineTransform
का उपयोग करके यादृच्छिक कोण से घूर्णन कर रहा हूं। अब ऐसा लगता है कि बटन घूर्णन के कोण के आधार पर आकार बदलते हैं।CGAffineTransform: UIButton पर रोटेशन बटन छवि का आकार बदलता है
UIGraphicsBeginImageContext(tempCtxSize);
[cookbookImage drawInRect:CGRectMake(imgOffsetX, imgOffsetY+frmOffsetY, cookbookImage.size.width, cookbookImage.size.height)];
[cookbookFrame drawInRect:CGRectMake(0.0f, frmOffsetY, cookbookFrame.size.width, cookbookFrame.size.height)];
UIImage *combinedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
…
UIButton *cookbookViewButton = [UIButton buttonWithType:UIButtonTypeCustom];
[cookbookViewButton setFrame:CGRectMake(0.0f, 0.0f, combinedImage.size.width, combinedImage.size.height)];
[cookbookViewButton setBackgroundColor:[UIColor clearColor]];
[cookbookViewButton setBackgroundImage:combinedImage forState:UIControlStateNormal];
CGAffineTransform rotation = [cookbookViewButton transform];
rotation = CGAffineTransformRotate(rotation, angle); // some random angle
[cookbookViewButton setTransform:rotation];