I want to know how to do this:
When a user clicks on the plus sign on the click The initial screen (see the first screenshot), the list will drop down and minimize the plus sign change (see the seconds screenshot).
< P>
You have to write your own. For example, here's a super simple example that shows you how to hide and show stuff I'm not using a graphical +/- button (but a simple text button), but hopefully it's enough for you Clues how to do this properly I shows the animation that shows the text panel (whatever you can put in the graphics or this panel).
There are several ways to do this and it is very simple, and clearly I have not spent any time on aesthetics, but hopefully it shows you some techniques that you can use Are there. I think the main trick is to put the stuff on your main view to appear on a UIView, give it the height of zero, and then expand the consciousness to expand the frame. You can also move the button, change the UIIm used for buttons, buttons, etc., but you get this idea.
// slideInViewController.m #import "SlideInViewController.h" @interface SlideInViewController () {UIView * _hiddenPanel; UIButton * _hideShowButton; BOOL _panelHidden; } @end @implementation SlideInViewController - (zero) viewDidoadload {[Super Viewedload]; // Flag _PanelHead = yes start; // Create the panel which will initially hide (the height of zero), but when you click on the button, the headline = [[UIView alloc] initWithFrame: CGRectMake (0.0, 300.0, self.view.frame.size.width, 0.0 )]; _hiddenPanel.clipsToBounds = Yes; [Self.view addSubview: _hiddenPanel]; // Add button _SideShow button = [UIButtonTypeRoundedRect] with UIButton Button; _HideShowton.fr = CGRT Chemic (40.0, 260.0, 40.0, 40.0); [_HideShowButton setTitle: @ "+" forState: UIControlStateNormal]; [_HideShowButton addTarget: Self-action: @selector (hideShowPanel :) for control EVents: UIControlEventTouchUpInside]; [Self.view addSubview: _hideShowButton]; // Now fill in whatever you want on this hidden panel UILabel * label = [[UILabel alloc] initWithFrame: CGRectMake (0.0, 0.0, self.view.frame.size.width, 200.0)]; Label.lineBreakMode = UILineBreakModeWordWrap; Label.numberOfLines = 0; Label.text = @ "This is a very long label. It's too long a label. It's too long a label. It's too long a label. It's too long a label. It's too long a label. It's a long label, it's a very long label This is a very long label. It is a very long label. It is a very long label. It is a very long label. It is a very long label, very long label. It's a very long label. "; [_hiddenPanel addSubview: label]; // Setup an additional after loading the view} - (IBAction) hidePanel: (ID) Sender {if (_panelHidden) {// If the panel was already hidden, then reveal it (and accordingly adjust the button accordingly) / Adjust) [UIView animateWithDuration: 1.0 Animation: ^ {_hideShowButton.frame = CGRactack (40.0, 60.0, 40.0, 40.0); [_HideShowButton setTitle: @ "- forState: UIControlStateNormal]; _hiddenPanel.frame = CGRectMake (0.0, 100.0, self.view.frame.size.width, 200.0);}];} Else {// if panel already shown , Then hide it again (and adjust / adjust the button accordingly) [UIView Animation with Duration: 1.0 Animation: ^ {_hideShowButton.frame = CGRectMake (40.0, 260.0, 40.0, 40.0); [_HideShowButton setTitle: @ " + "ForState: UIControlStateNormal]; _hiddenPanel.frame = CGRectMake (0.0, 300.0, self.view.frame.size.width, 0.0);}];} _panelHidden =! _panelHidden;} @end
Comments
Post a Comment