سؤال

Assume I have an image stored in Images.xcassets that is sliced; ie its capInsets property is set and I want to draw that image larger than its actual size in CoreGraphics. How do I do this?

Do I have to use the capInsets property to manually slice the image in to 9 parts and then grow/stretch the 9 parts manually or is there an easier way?

هل كانت مفيدة؟

المحلول

    UIGraphicsBeginImageContext(litView.layer.frame.size);
    [litImg drawInRect:litView.layer.frame];
    UIImage *resizedImg = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top