UITextView initial scroll position is not top on tvOS - uitextview

How to make the initial scroll position be 0 on tvOS? I tried setContentOffset:CGPointZero and layoutIfNeeded, but it's not working.
[self.textView layoutIfNeeded];
self.textView.attributedText = myLongAttributedString;
[self.textView setContentOffset:CGPointZero animated:NO];
[self.textView layoutIfNeeded];
This is similar but different from UITextView initial scroll position is not 0 because my given solution for iOS isn't working for tvOS.
You can quickly reproduce the issue from tvOS example from https://github.com/laptobbe/TSMarkdownParser/tree/3.x (commit fba04cdd59ac55fc324a2100fcb800af2153f2af in case I fix the bug in the future) and switching the selected output to UITextView (with keyboard arrow if you're on simulator):

Related

How do you resize the debug area height in Xcode 12.2?

How do I resize the height of the debug area in Xcode 12.2?
In Xcode 12.2, the debug area takes the entire height of my window, (from the bottom of the upper toolbar to the bottom of my screen). There is no handle to adjust the debug area height.
As I was typing my question I fixed the issue. It seems like this may be a bug. Press the green button to take Xcode fullscreen and then once again to go back to windowed mode. At that point the handlebars for resizing will appear.

Menu Bar Height in the LWUIT Form

Application develop in the J2ME using LWUIT. When I port this application on the Samsung Device it create the following problem.
int h = Display.getInstance().getDisplayWidth();
It returns 388 for the Samsung GT S5250. So when I draw an image using this dimension it displays a white strip at the bottom of the screen. When I call the Form.show() it displays correctly and height is 400 so how to resolve this issue.
I want to know how the Form size is calculated in LWUIT and how it takes MenuBar Height and white strip display at bottom of the screen.
I think you typed getDisplayWidth() where you meant to type getDisplayHeight().
Regardless, the problem you are seeing is due to a bug in the samsung device. LWUIT invokes the full screen mode in MIDP which hides the native title area, however that doesn't always happen immediately in some devices and thus LWUIT gets incorrect information from the devices. A refresh usually solves this and by the time LWUIT draws on the screen the size is corrected.
Generally the solution is rather simple, create generic code to create your image and if the image dimensions are inappropriate when you are about to draw to the screen then just recreate the image on the fly. This will also solve the issue of device rotation which might pose a problem too.

How to stop view resizing after unhiding the NavigationBar

I have a view with a UITabBar and the navigation bar is initially hidden. When I press the next tab I want the nav bar to be shown, but when I do this using setNavigationBarHidden: the view gets resized, and the tabbar is pushed out of the screen. How do I setup the views to where they won't get resized? Or get resized properly?
You will have to check your autoresizingMasks. You can adjust them programmatically or via IB. Autosizing is available in the Size Inspector on the right.
You will mostly have to change the tab bar's mask to fix it to bottom and left. Rest of the subviews will have to be handled as needed.
[self.navigationController setNavigationBarHidden:NO animated:NO];
or
after that
set urview frame to exactly for 44reduce(which is navingation bar height) from height.

ScrollView as subview does not respect frame boundaries

I have a UIScrollView (managed by a view controller) which I am using both full screen and as a subview. The full screen version works fine - the subview does not.
The subview is positioned so that it takes up about the bottom half of the screen, with a small - 20 pixels or so - margin at the bottom.
Initially it displays in the correct position but overwrites the bottom margin - even though the scrollview's frame is set to leave the margin.
When I scroll the view up by dragging it, the whole view moves upwards and obscures the top of the window. The frame stops moving when it hits the navigation bar at the top and starts scrolling like a normal scrollview. If I scroll it enough it eventually reveals the margin at the bottom of the screen.
I am at a loss to know what to do - I've tried every spring combination I can think of. I'm now looking at subview clipping.
Images below. The first shows the scrollview on initial page load, positioned correctly aside from lower margin overwrite. The scroll view has a white background.
The second image shows it scrolled up toward the top:
The third image shows it scrolled all the way up to the top - note that the lower margin has become visible.
I'm not 100% sure on this one, but worthy the shot: my guess is you're likely not setting the Bounds property correctly on your table.
To solve this issue, the easiest way would be to set myscrollview.clipsToBounds = true.
Something is definitely wrong here. I think what happens is that you are adding the same instance of scrollview as a subview on itself. So basically what you are left with, is one instance alone. Anything you add to the "subview", is basically added on the superview, since it is the same object.
For example, this is what I think you are doing in the view controller:
//...
private UIScrollView myScrollView;
public override void ViewDidLoad()
{
this.myScrollView = new UIScrollView();
this.View = this.myScrollView;
this.View.AddSubview(this.mySrcollView); // same instance
this.myScrollView.AddSubview(aUIButton); // "aUIButton" will be added in View also, since it is the same object
}
If this is the case, it is wrong. I suggest not changing the controller's view at all. If you want to have a controller that has a fullscreen UIScrollView, just create it and add it as a subview, making sure the AutoSizesSubviews property to true.
That's my understanding at least.

UISplitView Orientation problem

I use a TabBarController that contains 1 splitViewController and a standard viewController.
Everything works fine except when I rotate the device.
On the SplitViewController when I rotate the device from Portrait to Landscape and Landscape to Portrait everything is ok.
When I move to the tabBar that contains the viewController, when I rotate the device in any direction, everything is also ok.
But if the last orientation of the splitView controller was landscape and from the ViewController I rotate the device to Portrait, when I go back to the SplitView Tab, I lost the popover button..
Everything is displayed well if I rotate the device.
Any help?
This is a default problem for cases when you use UISplitViewController inside UITabBarController. The catch is, the device rotation notifications are not received by the UISplitViewController, if it's inactive. You can find more details here:
UISplitViewController in a TabBar ( UITabBarController )?

Resources