IOS development-custom controls, ios-Controls
Is there any such requirement? You can customize a panel with several controls in it and use this panel on multiple pages.
There are three ways to solve this problem:
1. inherit UIView and write a class. Add the required control in the form of code to complete the layout.
2. Use the XIB layout file to complete the Layout
3. Use storyboard to complete Layout
Among these three methods, 1 seems to be a high-end atmosphere and has been hitting for a long time. Although I am a technical controller, I also dislike this pure feeling.
3. UIViewController cannot meet my needs and is not easy to use. (It may be useful. I won't use it. Please advise)
So I will explain how XIB combines controls to implement it by itself, and I will not talk about the cause and effect here. It will be a step-by-step process for half a day, so it will get dizzy and go straight to the final usage.
The sending method is divided into three steps:
1. Create a new class that inherits from NSObject to store the UIView in the Custom XIB.
A. To facilitate adding a class method to this class
+ (Id) viewFromNibByName :( NSString *) name {
FileOwner2 * owner = [FileOwner2new];
[[NSBundlemainBundle] loadNibNamed: nameowner: owneroptions: nil];
Return owner. view;
}
2. Create an XIB file.
A. Set the XIB size,
B. Set the FileOwner of XIB to the class created in 1.
C. Associate the View with the FileOwner so that the FileOwner can operate on The View.
3. Use it in other files
// Load View5
UIView * view5 = [FileOwner2viewFromNibByName: @ "View5"];
[View5setFrame: CGRectMake (0,400,375,100)];
[Self. viewaddSubview: view5];
Summary: Multiple XIB instances can share one FileOwner. In this way, you can use a static FileOwner method to create different panels by name.
How can I use Xcdoe4 to develop custom controls for IOS4?
The first thing you need to write is the control, which depends on the class you think you need to inherit from. For example, you can still inherit UIButton to write some extensions, or use UIView to write them, and write them according to the functions you want to implement.
Ios development problems
UI development is purely a custom control. Custom views tend to be visually displayed by users, mainly for CAAnimation and CALayer.
For example, your boss may ask you to create a TableView in the ListView (Android platform) style. At this time, you are doing a typical UI development.
Application development mainly involves program logic, Socket, and video processing frameworks. Your program runs behind and what you cannot see. For example, if your program requires webservice communication, you need to perform network processing.
The game is complicated. Basically, you need to use all of the above two.