最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

ios - Why is ImagePlaygroundViewController sourceImage not working? - Stack Overflow

matteradmin6PV0评论

I'm trying to create a ImagePlaygroundViewController in my iOS application and it works great. However when I try to pass in a sourceImage property it doesn't use that sourceImage as the base for the image it generates. Normally with ImagePlayground it shows the image around the image it generates, but it isn't doing that.

I'm trying to create a ImagePlaygroundViewController in my iOS application and it works great. However when I try to pass in a sourceImage property it doesn't use that sourceImage as the base for the image it generates. Normally with ImagePlayground it shows the image around the image it generates, but it isn't doing that.

Share Improve this question asked Nov 16, 2024 at 23:54 Charlie FishCharlie Fish 20.7k23 gold badges107 silver badges200 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

It took me hours of research to figure out what is going on here. There are a few requirements in order for ImagePlayground to use your sourceImage.

  • Image must be at least 384x384 pixels
  • Image must be no larger than 4096x4096 pixels
  • Image must be square

While Apple does mention the recommended sizes in the documentation they make it sound like it's a recommendation as opposed to a requirement. Additionally Apple doesn't mention anything about the image needing to be square.

For some reason when you manually add an image to an ImagePlayground it doesn't seem like any of these requirements apply. It seems to only apply when passing in images through that sourceImage property.

I tested this on iOS 18.2 (22C5131e) and Xcode 16.1 (16B40).


Edit: I just tested this some more. And it looks like images larger than 2048x2048 pixels also do not work. This was tested on the same versions as mentioned above.

Post a comment

comment list (0)

  1. No comments so far