What is the alternative of visible true/false for views in cocoa-touch?
I'm customizing a tableviewcell which is still very hard to me.
After reading apple's guide, I'm customizing my cells by loading them from a nib file, and managing them programmatically.
so instead of creating two different types of nib files (tableviewcells) one with textfield, and another with pickerview.
I'm doing a hybrid cell. i.e. In my nib file, i'm adding a UILabel, UItextField, UIPickerView.
Now on the 'cellForRowAtIndexPath' for the tableview (after i've bound each cell to the nibfile) i want to be able to programmatically use the pickerView OR the textfield. Now there's no 'visible' property to use in order to show one and hides the other.
So what's the best approach here. I'm a bit new to cocoa , and the framework is not giving me many options. So for example if indexpath is 0.1 i want it to be a pickerViewCell. and if indexPath is 0.2 , i want it to be a textfieldCell.
So if indexpath is 0.1? what should i do? should i dispose of the textfield? change its coordinates to somewhere that can never be viewable? disable it? what? and if my approach is wrong and not recommended, what is the recommended way? should i go back and remove the pickerView from the nib, and create another nib file with only label and pickervi开发者_JAVA百科ew? and upon loading decide which one to load? Thanks
View visibility is controlled by hidden
property (that is - the opposite of visible) - you can use it in your case
精彩评论