how to set the ticker for navigation item title using Monotouch? - iphone

I have set the title for navigation item on top of the screen. But the title text exceeded from the screen width. So I need scrolling title on the top of the screen. How to do this with MonoTouch? Is it possible?

You will most likely have to set a custom view for the text in the UINavigationItem's toolbar.
I have done similar with UIBarButtonItems, basically I created a UILabel with a width and centered text and set it as the custom view for it.
Take a look at this example, it's in Objective-C but you get the idea.

Related

How to add a titlebar to a popover

I'm trying to replicate the appearance of the (no longer functional) Degrees app, but I can't figure out the components used to make the title bar (highlighted here in red).
I've managed to get my app running as a menu bar agent, and I've wired up a popover to display a window view on click. But it's not quite right: my window's title bar disappears when in the popover, and the bar used in the Degrees app is wider than the one provided by the stock window control.
How might I mimic the appearance here? it just an ImageView?
Popover's don't show window title bar's as you've discovered.
Just add an NSView at the top of your window view and add a label for the title and a button for the "Done" button to create your top bar with desired height. Then add a horizontal line to the bottom of this title view and programmatically set the background color of its layer to whatever you desire. Offset all your other views by that bar height.
Basically:
[Window]
[View]
[View (Title Parent)]
[NSTextField]
[NSButton]
[Horizontal Line]
[Other Views]
For getting the gray background, in your NSWindowController windowDidLoad,
self.titleParentView.wantsLayer = YES
self.titleParentView.layer.backgroundColor = [NSColor grayColor].CGColor;
where titleParentView is an IBOutlet connected to the view you created above in the xib/storyboard

Making a Title scroll in a UIScrollView with the text below

I have a storyboard with a UIScrollView taking up the entire iPhone screen. I have a label at the top for the title, and then a textview below that which has text loaded into it from a .txt file. However when I scroll, it scrolls through the large body of text with the title staying put at the top of the view, even though the label is based in the scrollview rather than outside of it. Any ideas how I can fix this?
Thanks!
textView has its own scrolling method built in, so your textView will scroll independently of your scrollView. Create the title within the textView or set text view not to scroll in Interface builder and use your scrollView

the scroll bar is hidden behind the keyboard

I have a UITableViewController with a search bar. When I touch the screen to start the search, I hide the UINavigationBar and show the scope bar search to optimize the space.
For the TableView not hide behind the keyboard and search bar, I add header and footer to the table with their respective heights.
Everything working correctly. But the scroll bar is still hiding behind the search bar and keyboard.
Any suggestions to solve this or some other way to do this whole mechanism?
Resize the table view's frame by subtracting the height of the keyboard.

UINavigationItem title label set width?

In my UIViewController i set my title dynamically so i do not know the length of the string that will be shown in the navigation bar and because of that i have the current situation:
alt text http://img94.imageshack.us/img94/2484/picture3vf.png
is there any way to set the width of the label that displays the title in the navigation bar? or should i think of a with, compare the text length to it and if it is too long should i resize it and display the famous "..." ?
I know that i can add an UILabel as subview to the navigationBar but i don't want to use that solution.
Thank you!
Maybe you could add some dummy buttons to the navigation bar that will sit directly underneath your buttons. That would show the normal text behavior, but also allow you to play with your colors.
I'm not sure how you did that. If I'm creating a navigation view and setting a title that is too long it will be shortened with "..." by default. These black buttons do not seem to be default buttons.
You can use sizeWithFont method of NSString to know the size your label will take. Note that you can add a maximum size if you know your label width shouldn't be greater than a certain value
// Get the size really needed for the label string
CGSize expectedLabelSize = [self.text sizeWithFont:self.font
constrainedToSize:maximumSize
lineBreakMode:self.lineBreakMode];

Toolbar placement off with Interface Builder

I have a view xib that I'm manipulating through IB (for various reasons) and it will be launched as a modal view in code. I have a Toolbar at top and another one at bottom with some other UI elements in between. When I run the app, the placement of the top Toolbar isn't as I see it during the layout in IB.
In IB, the top Toolbar is placed at top below the status bar correctly and the next UI element (a label) appears below it. However, in the simulator, the top half of the Toolbar appears underneath the status bar and thus making it look cut off and there is a lot of space between the Toolbar and the label, which isn't reflected in the layout in IB.
For modal views, should the height of the view be different? If so, what does it need to be?
The view's height is set to default height value of 480.
Is the style of the status bar set to Translucent Black in IB? This causes the status bar to not consume any space and as a result "float" above the underlying Views.