1. Use a Uiimageview instance to make a child view, and put the last face
Uiimageview *custombackgournd = [Uiimageview alloc] initwithimage:[uiimage imagenamed:@ "background.jpg"];
Self.background = Custombackground;
[Custombackground release];
[Self addsubview:background];
[Self sendsubviewtoback:background];
If you are using IB, add Uiimageview to the Xib file and put it at the bottom.
2.
Self.view.backgroundColor = [Uicolor colorwithpatternimage:[uiimage imagenamed:@ "Background.jpg"];
Recommended use this, convenient.
Use in code today
Self.view.backgroundColor = [uicolorcolorwithpatternimage:[uiimageimagenamed:@ "[email protected]"];
The result [email protected] This picture was originally 640x960, the results show only the left half out with the top half out.
The correct code should be
Self.view.backgroundColor = [Uicolor colorwithpatternimage:[uiimage imagenamed:@ "INSTRUMENT_BG"];
In this case, the image will be automatically matched.
The wrong wording led to a twice-fold enlargement of the image, so it looked half-done. In addition the suffix of the picture is generally omitted as well