雖然不夠友善,但是程式碼也不會太長的啦XD
執行結果:

下收程式碼~
圖片 test_arrows.png:

CGRect rect = CGRectMake(0, 0, 60, 30); //先確定要切的大小
UIImage *arrows = [UIImage imageNamed:@"test_arrows.png"];
UIImageView *arrviewer = [[UIImageView alloc] initWithFrame:rect];
[arrviewer setImage:[UIImage imageWithCGImage: CGImageCreateWithImageInRect([arrows CGImage], rect)]];
[arrviewer setCenter:CGPointMake(45, 120)];
[self.view addSubview:arrviewer];
沒有留言:
張貼留言
歡迎大家留言提問,我會答的都會盡力回答!
如果太久沒出現回應就是我又忘記回來看留言了TAT