Friday, January 10, 2014

How to create controls like split views

posts by caulxjxys on 2013-12-14 09:07:35 Edit
Will Daniel, the following interface in the form of advice on how to design the controls in the IPHONE:


Button on the left and the classification is run according to how many types of analytical procedures dynamically generated? Thanks!
Reply:
The middle is a custom view to display numbers on both sides of the label two button process the data internally or externally to look at this program needs
Reply:
Sorry, there is misleading to this figure, not a red circle inside the control, I mean the left shows "cold dish category", "seafood", so the tab, but is based on the contents of the dynamic analytical procedure the kind of display; according click on the right side of each different tab, displays a different view.
Reply:
The reply was deleted administrator at 2013-12-15 13:10:36

Reply:
reference to the second floor caulxjxys reply:
sorry to have misled the role of this figure, not a red circle inside the control, I mean the left side of the display "cold dish category", "seafood", so the tab, and the kind of dynamic display content based on analytical procedures; according click on the right side of each different tab, displays a different view.


The left one tabView, on the right a containerView, click on which item, first before the child views on remove container out and then load the new view to be displayed on the container. Click on the small triangle button to display the current fine.
Reply:
Give you ideas:
According to the principle of separation of duties, it is recommended to isolate a custom menu on the left. The main function of the control is at the click of a class of dishes, the dishes can know the information about the current and pass data to this action and its "sender" side. So the controls need to set up a "proxy"
Assuming the following menu entity
 @ interface MenuItem: NSObject 
@ Property (nonatomic) NSInteger MenuID;
@ Property (strong) NSString * MenuName;
@ End


This agency agreement requires data at the click of a dish when you need to pass the class, you should have a menu index, and the menu entity

 @ protocol MenuItemDelegate:  
- (Void) menuItemDidSelected: (MenuItem *) item index: (NSInteger) index;
@ End


This control generally should do
 @ protocol MenuItemDelegate 
@ Class MenuItem;
@ Interface LeftMenuControl: UIView
@ Property (strong) NSMutableArray * items; / / / / / store all of the menu item
@ Property (nonatomic, weak) id delegate;
@ End


In its implementation file should do
@ Implementation LeftMenuControl

/ / / / When an event where the button is selected a menu when handling
 - (void) menuSelected: (id) sender {
UIButton * menuBtn = (UIButton *) sender;
NSInteger index = menuBtn.tag;
if ([self.delegate isRespondToSelector: @ selector (menuItemDidSelected: index :)]) {
[Self delegate menuItemDidSelected: [self.items objectAtIndex: index] index: index];
}
}
@ End


Reply:
Connect Wen

If you create a diagram corresponding display controller SelectMenuViewController
 
# Import "LeftMenuControl"
@ Interface SelectMenuViewController: UIViewController

@ Property (strong) LeftMenuControl * leftMenu;
@ End

-------------------- Achieve ---------------------
# Import "MenuItem"
@ Implementation SelectMenuViewController

- (Void) viewDidLoad {
leftMenu = [[LeftMenuControl alloc] initWithFrame: .....];
NSMutableArray * items = @ {@ {MenuID: 1, MenuName: @ "cold dish category"}, @ {MenuID: 2, MenuName: @ "seafood"}}; / / / / 300 words omitted here
[LeftMenu setItems: items];
[LeftMenu setDelegate: self]; / / / / set the proxy

}

Protocol method
/ / / / / / implemented in the controller- (Void) menuItemDidSelected: (MenuItem *) item index: (NSInteger) index {
NSLog ("you selected menu is:% @ at index:% d", [item description], index);
}


@ End

Reply:
There is a need, you can outsource to me.
Reply:
Tabbar can rewrite such a DEMO code4app on a lot .......
Reply:
reference to the 7th floor zhanglei5415 reply:
really need, you can outsource to me.

--------------------------------------------
Oh well, I write down you move back to a good end of the project considering outsourcing to you
Reply:
reference to the 9th floor caulxjxys reply:
Quote: references to the 7th floor zhanglei5415 reply:

There is a need, you can outsource to me.

--------------------------------------------
Oh well, I write down you move back to a good end of the project considering outsourcing to you


Oh, good. Mutual plus attention to it.

No comments:

Post a Comment