Let me preface this by saying this works perfectly on the iphone 4 - retina and regular.
I have a grouped table that has 4 sections. to set it up i use the dispatch_async stuff in viewWillAppear to grab the information from a server - and then call reloadTable when the server returns.
after the table has been reloaded with the correct information, when i try and scroll down i see more cells but it gives resistance as if i had already reached the end of the table even though there are 3 or 4 more table cells to show and bounces back.
there is one cell that has an image and some text that i use cell.addsubview to add some subviews to it in the cellForRowAtIndexPath function.
but all the other cell heights are normal (44)
I am using IB to have the grouped table view and don't set the frame,bounds, or anything with it in my code - just set the various tablecell heights using the correct function.
does anyone know why it would work perfectly in the iphone 4 (i can scroll down to the bottom and see all the cells) and not in the iphone 5?
Thank you.
I had autolayout checked in the Xib files.
To fix the problem i set self.view.frame.size.height to 568 in the top view controller (i was using a navigation conroller that loaded table views). once i did that, all the child views worked correctly.
I have same problem to fix like below optimized way
if your using autoLayout don't be hardcode just use constraints
i don't know how to use XIB but i always use like this
tableview.frame = cgrectMake(0,320,self.view.frame.size.width,self.view.frame.size.height-64);
64= nabvar height(44)+ top bar (22);
hope this help :)
Related
Recently, I encountered a problem with the Interface Builder which I failed to solve. I'm using a UICollectionViewController and whenever I add a Cell it immediately shows a orange rectangle (indicating a auto-layout update). Updating the frame/cell doesn't change anything. The warning associated with the orange marking reads "Expected: height=Y, Actual: height=X" where Y is always exactly X-100. That is: When I set a custom cell height of 193, it says "Expected: height=93". This happens no matter which size I enter.
The problem with this is that I have many difficulties with the subviews and their constraints. For instance, if I add a subview with the constraint to keep the same height as the cell, it will be shown as 93 (the expected height), even though my cell should be 193. Layouting becomes impossible.
I tried adding a new cell, same issue. I tried removing every subview and re-adding them, nothing.
Any ideas are highly welcome.
Thank you very much!
Solution found ! (Xcode 9.2)
The bug seems to only happen when you try to embed the UICollectionViewController in a Container View in the storyboard. The workaround is to remove the segue while you set your constraints, and re-add the segue once your constraints are well set.
I also think that setting UICollectionViewController size as Freeform could be responsible of the bug. If so, try to set constraints before changing the size.
Hope this helps !
I'm not sure if this solved it, but the warning and issue disappeared once I did the following:
Select the CollectionViewController in Interface Builder and set the size to freeform and make the height larger, large enough to show all your template cells. (Plus: maybe refresh the views). That solved the issue for me.
In my case, I have added two collection view cell, withing collection view Controller.Only setting the view controller to free form wont help us. Need to update the size, to get rid of the warning.
updating collection view cell frames, wont help us. Warning will be continuously changing its length.
I tried to work without considering the warning, as I have set my collection view cell size programmatically and it does working as expected.
I think it's just a strange bug
I delete the collectionViewController in SB, then create a new one, the problem disappear
This is a common bug with Interface Builder. I don't know the exact cause, but I believe it's something to do with placing collection views inside arrangement views that do not have an exact size. I've seen it when putting them in scroll views, stack views and container views.
There is a simple fix, although I believe this to be a bug in IB that ought to be corrected by Apple rather than hacking around it. The solution (for me at least - your mileage may vary!) is to place the collection view inside an ordinary UIView and pin its edges to it, then place that parent view in the position that you wanted your collection view with all the constraints it required.
I usually found that there were actually no auto layout issues at run-time, which is why I believe this to be purely an Interface Builder bug.
I really need your help.
I'm new at developing Xamarin.iOS apps and now I'm totally stuck.
I cannot get the hang of how to implement a dynamic ScrollView in iOS, it was fairly easy to implement on Android.
So what I'm trying to implement is a view that contains mostly text (that will be quite long, hence the scrolling, but also two buttons.
Here is a gif in Android showing what I'm trying to achieve
The view is like this:
Header
Long text
Copyright button
-- Copyright text
Terms of usage button
-- Terms of usage text
I have struggled with the scrolling so long and I really need your help.
All of the text properties are getting bound to the view by binding with MvvmCross so the view can't be with hard-coded heights and widths, it needs to adjust properly.
Can somebody please show me with a sample project how to implement it?
The view needs to be in a .xib view (because of MvvmCross) and it cannot contain a UIViewcontroller.
So the solution needs to be in a simple UIView
I'm working on a Windows, with Visual Studio 2015 enterprise, and I cannot use a Mac (and Xcode) other than to compile my code with.
What I've tried is a solution like this:
UIView called "MyRootview"
-- UIScrollView called "MyScrollView"
-- -- UIView called "MyContentView"
Can you please help me?
Method 1:
Use a TableView instead of ScrollView. Make the header row 1, long text row 2, button 1 and it's text row 3 and button 4 and it's text row 4.
Give row height for the last 2 rows so that you only see the button and on button click increase the row height and reload the table section.
Method 2:
If you keep wanna using ScrollView, put the button data in a label and give it a height of 0 (and number of lines 1) to hide it and on button click remove the height constraint and set the number of lines to 0 (max).
I used FluentLayout instead. Very easy.
https://github.com/FluentLayout/Cirrious.FluentLayout
I'm trying to get the split view controller working properly but apparently there's a bug in there or I'm missing something.
First of all, I've started a blank OSX Obj-C application, and in the Storyboard I've dragged the split view controller. Next, I've linked the segues from the main window controller to the split view and added two labels.
http://i.imgur.com/dlFObaF.png
When I build the project, it shows only the second page. Not to mention strange window size in the final build.
http://i.stack.imgur.com/IqRqr.png
I've tried everything.
This occurs in both vertical and horizontal split view.
Any suggestions?
I had the same issue myself today, but it's just the split line wasn't initiated properly.
To see, this, once you run your app, move your mouse toward the edge of the window and drag it, you will now see another view emerging.
To my best knowledge, I do not know how to fix this in IB or in code. Apparently NSSplitViewController does not have a property like UISplitViewControllerAutomaticDimension. Would appreciate if someone can contribute to this.
Edited: Found an answer via another thread. Basically, try to add some constraints to the subviews inside each view and that should prevent the size of a view to be zero. In my toy example, adding margin constraints to my buttons worked out well.
I've run into a peculiar problem with Xcode. I have a custom UITableViewController that appears as a popover for a few settings in an iPad app. It's a static table view with just 3 cells in 2 sections. It looks fine in the Storyboard editor, but at runtime the cells with custom views (UILabels, UISlider, UIButton) do not show up at all, but those custom views do (in random places).
When I delete the custom elements from the cell or change the cell to anything but custom then they show up fine, even if the view (like basic for example) contains a label in its Content View. It's a lot clearer to see with the attached picture.
To solve this, I've created a completely empty cell below those with custom elements. It looks fine, but I can't interact with any elements. User Interaction is enabled for all elements, cells, and the entire table view. If you have any ideas how to solve that or how to get the cells working properly so I don't need the blank cell hack that'd be much appreciated!
I'm using Xcode 6 beta 7 on OS X Yosemite, programming in Swift.
Thanks in advance!
The question has been answered here Stack Overflow Setting up Auto Layout connections from the label to the Content View solves this issue.
It was a combination of the above link as well as this one that finally solved it.
I added the 4 constraints from each object (UIButton and UISlider) to all four sides of its cell's Content View (top, bottom, leading, trailing). Then, I had to check the "installed" checkbox for each constraint, which was not checked.
Thank you so much for your help, it's working great now!
I have quite a large storyboard with many views, a lot of them do not display at the correct size or even have a navigation bar. Is this some kind of bug in XCode?, because they all look fine when simulated or built to a device.
Thanks
I have faced it lot of time below solution works every time.
Try This One:
1. Select the StoryBoard you are facing problem
2. Goto Attributes Inspector -> Simulated Metrics -> Size -> There are four options(default is inferred)
3.Select or switch between options other then default(repeat it twice or more if needed) then resize your views and controls to fit your selected screen size.
According to me this happens because:
Sometimes inferred (size) behaves as if its an 3.5 retina screen but our storyboard size is retina 4 full screen or vice-versa
Best Practice to avoid such problems :
When you start working with storyboard first select appropriate size you want to work with (3.5 or 4 full screen) then only you should set your views or controls.
I had this issue when embedding Container Views into the same View Controller.
With three Container Views embedded I found that Xcode auto-sized two of them when I selected "Apply Retina X.X Form Factor" but the size of the third was left untouched.
Solution
In the parent View Controller the third Container Viewer was missing constraints. Adding those constraints got every thing straight. (I also had to size the Container View to fill its parent Controller Viewer)
This is a very simple step. After selecting View Controller, go into your Simulated Metrics and select size and place it on iPhone 4-inch and then select Orientation and place it to Portrait and there you have it. Your main storyboard metrics are fixed. Again this is very important to know that this will not mess up anything your height or width in your project