objective c - How to deactivate or hide a view in XCode? -



objective c - How to deactivate or hide a view in XCode? -

in nsview have container view , 2 nsbutton's (see picture). nsbutton's alter content in container view. show view , hide other one, this:

@ibaction func changeview(sender: nsbutton) { switch sender.id { case "button 1" { view1.hidden = true; view2.hidden = false; } case "button 2" { view1.hidden = false; view2.hidden = true; } } }

it works properly, since in views there's lot draw (fields, buttons , images), switching view little bit (very little) slow. , have uncertainty method not right one.

how switch view in proper way?

hiding should fine. might want switch order set view hidden before setting other view unhidden.

you remove view view hierarchy (removefromsuperview()) way hide it. sure in code maintains strong reference view. view controller does, that's presumably plenty (assuming have strong reference view controller).

and, yes, putting views in nstabview , having switch them works (basically using 1 of above techniques).

objective-c xcode osx nsview

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -