두 번째 이미지를 덮고있는 상처가 있습니다. 네비게이션 항목은 높이가 63 픽셀이며, 페이지 하단에 사용자가 다음 페이지로 이동할 수있는 버튼이 있습니다.xcode CGRectMake 치수가 엉망입니다.
좌표가있는 직사각형을 그릴 때 CGRectMake(0, 63, mainScreenwidth, mainScreenheight - 63)];
이미지는 완벽하게 표시되지만 페이지 하단의 버튼을 덮습니다. 그때부터 변경하면
은 Y가 엉망 청크 측정 후 CGRectMake(0, 100, mainScreenwidth, mainScreenheight - 63)];
좌표 : I는 높이를 말할 때 이미지 엉망 아래 스크린 같다 mainScreenheight - 126
(바닥에서 63 픽셀) 될 높이 대신에 63을 입력하십시오.
다음은 내 ViewController입니다.
ScratchableView *scratchableView = [[ScratchableView alloc]initWithFrame:
CGRectMake(0, 63, [[UIScreen mainScreen] applicationFrame].size.width,
[[UIScreen mainScreen] applicationFrame].size.height - 126)];
다음은 내보기입니다.
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
CGSize newSize = CGSizeMake([[UIScreen mainScreen] applicationFrame].size.width, ([[UIScreen mainScreen] applicationFrame].size.height - 126));
UIGraphicsBeginImageContext(newSize);
[[UIImage imageNamed:@"scratchcover2.png"] drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
scratchable = newImage.CGImage;
width = CGImageGetWidth(scratchable);
height = CGImageGetHeight(scratchable);
self.opaque = NO;
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceGray();
CFMutableDataRef pixels = CFDataCreateMutable(NULL , width * height);
alphaPixels = CGBitmapContextCreate(CFDataGetMutableBytePtr(pixels) , width , height , 8 , width , colorspace , (CGBitmapInfo)kCGImageAlphaNone);
provider = CGDataProviderCreateWithCFData(pixels);
CGContextSetFillColorWithColor(alphaPixels, [UIColor blackColor].CGColor);
CGContextFillRect(alphaPixels, frame);
CGContextSetStrokeColorWithColor(alphaPixels, [UIColor whiteColor].CGColor);
CGContextSetLineWidth(alphaPixels, 20.0);
CGContextSetLineCap(alphaPixels, kCGLineCapRound);
CGImageRef mask = CGImageMaskCreate(width, height, 8, 8, width, provider, nil, NO);
scratched = CGImageCreateWithMask(scratchable, mask);
CGImageRelease(mask);
CGColorSpaceRelease(colorspace);
}
return self;
}
누구든지이 문제를 해결할 수 있습니다.