ich want to make an prototype app and added a table view where i want to put buttons and labels in.
It looks like this:
The problem is that when I run the app the button for example is not showing up. Does someone know why?
Still if I change the background a a single cell it's not showing.
Related
I have a simple cocoa app for macos, the whole UI is created programmatically i.e. I'm not using the interface builder (no xib-s, no storyboards).
I'm creating a scroll view, adding a table view with a single column and feeding it with cell views containing check boxes.
So the view structure looks like this:
window
root content view
scroll view
clip view (created automatically by the scroll view)
table view
cell view
check box
The problem is that the check box is behaving weirdly in this structure - it doesn't repaint itself when clicked. BUT - if you click it and then resize the window (I have auto-layout constraints there, too), then the table view is redrawn and the check box is redrawn too and thus updated.
I've been trying various things to localize the problem (I'm new to macos, therefore I tried pretty much everything) and found out that if I turn the wantsLayer on for the cell view or the check box itself, then check boxes start working properly.
If I don't wrap the table view into the scroll view, then everything works without wantsLayer, too. When I create check boxes out of the table view - just put them on the root view itself, they also work properly.
Please explain me why do I need the wantsLayer. Or maybe I need something else in reality and wantsLayer works just by accident?
so im toying around with Autolayout with a Storyboard.
So i have a View, containing a Button and to its right a TextField. (Sadly i cant post Pictures here yet) ;)
now what im trying to do, is that by default, when my view gets shown the button is hidden, and the view kinda resizes it self to only contain the Text field.
And after the text field is clicked (selected) the button is shown and with this the view resizes itself to fit the button and the Textfield.
I think i might be able to do that in code, by simply updating the View width with the width of the contained and shown items.
But i feel like there has to be a easy way to do that with Autolayout.
So i tryed many things, but it just doesnt work, no matter what constrains i add.
How can i solve this ? Thanks in Advance.
EDIT
i forgot to mention, even if i remove the button from the superview i get bad results, i suppose the reason is that the constrains get messed up if i remove the Button.
So thats not an Option.
I was wondering if any one knew how to save an load fonts on a textview. The app lets the user select the font for the text view but when they switch views and come back it is gone. Does any one know how to save that and then load it. Thanks so much.
Also if any one know how to save text color that would due great also.
Thanks so much!!
What you have to do is to give all the textViews a specific tag values and on navigation before view willDisappear you have to store all the values to array and on navigating back to the view on viewWillAppear fill all the textViews using the tag values.
I have a table view in an iPhone xcode tab bar application that shows data either alphabetically or numerically, depending on a user selected option in one of the tabs. It works for the most part, but when I change the option and then go back into the table view, the table view initially looks like it did before the option was changed. However, as new cells get scrolled into view, they have the new display mode.
I can identify when the option changes, but I can't seem to get the code correct that would re-initialize the cells such that the next time they come into view they have the correct values. The data comes from a static array with set values, so I don't want to do anything with the data source, just the table view.
In other words, once the display option changes, I want to wipe out the table view I have so that the next time the table view displays it will show the correct data right from the start rather than after scrolling occurs.
Any help would be appreciated. Thanks.
It sounds like you want to call reloadData on the TableView.
[yourTableView reloadData];
I have a tool bar with buttons whose image is set to a particular image.When the user clicks a button in the main view, i want to change the image of one of the toolbar buttons to another image.I tried many methods.Everything ran without errors, but none showed any change in toolbar.Any suggestions?
There is a tutorial for this:
How-to-change-a-uibarbuttonitem-in-the-iphone-toolbar
This is a great tutorial because it goes over changing the images based on state as well.