Contentmode Property
-
With scale words: pictures may stretch
- Uiviewcontentmodescaletofill
- Stretch the picture to fill the entire ImageView
- The picture shows the same size as the ImageView.
- With aspect Words: Maintain the original aspect ratio of the picture
- Uiviewcontentmodescaleaspectfit
- Guaranteed to just see all the pictures.
- Uiviewcontentmodescaleaspectfill
- Stretch to the width or height of the picture as ImageView
-
No scale words: The picture will never be stretched, keeping the original size of the picture
- Uiviewcontentmodecenter
- Uiviewcontentmodetop
- Uiviewcontentmodebottom
- Uiviewcontentmodeleft
- Uiviewcontentmoderight
- Uiviewcontentmodetopleft
- Uiviewcontentmodetopright
- Uiviewcontentmodebottomleft
- Uiviewcontentmodebottomright
Small grammar points
- Cannot modify directly: Member of the Structure property of the OC object
- The following wording is wrong.
imageView.frame.size = imageView.image.size;
CGRect tempFrame = imageView.frame;tempFrame.size = imageView.image.size;imageView.frame = tempFrame;
Initwithimage: Method
- The size of the ImageView created with this method is the same as the size of the incoming image
3 Ways to modify a frame
- Directly using the CGRectMake function
imageView.frame = CGRectMake(100, 100, 200, 200);
- Take advantage of temporary struct-body variables
CGRect tempFrame = imageView.frame;tempFrame.origin.x = 100;tempFrame.origin.y = 100;tempFrame.size.width = 200;tempFrame.size.height = 200;imageView.frame = tempFrame;
imageView.frame = (CGRect){{100, 100}, {200, 200}};
[abc performSelector:@selector(stand:) withObject:@"123" afterDelay:10];// 10s后自动调用abc的stand:方法,并且传递@"123"参数
- Simple playback of audio files
// 创建一个音频文件的URL(URL就是文件路径对象)NSURL *url = [[NSBundle mainBundle] URLForResource:@"音频文件名" withExtension:@"音频文件的扩展名"];// 创建播放器self.player = [AVPlayer playerWithURL:url];// 播放[self.player play];
Ios-ui control's Uiimageview