I am developing an iOS app using Appcelerator. I need to place a transparent view over the window title to be able to click on it.
I am using this code:
// Create the view
var titleView = Ti.UI.createView({
width:210,
height:40,
backgroundColor: 'transparent'
});
// Add the view to the title
win.titleControl = titleView;
It works fine but the title does not shine through.
What can I do? Do I really need to add a label too?
Thankful for all input!
yes you need to add a label.
once you set the titleControl to the titleView, you have lost the text that use to appear
Related
I work on a Xamarin native app, where I show a modal view containing a list of countries.
I would like to know if there is a way to add a Navigation Bar to this view through the Controller?
Of course, the Navigation Bar will not contain the back arrow button, but a Title and a right button allowing to close this view.
Thanks for your suggestions.
The modal you present needs be wrapped in a UINavigationController rather than only being a UIViewController. This will give you a NavigationBar.
var modalViewControler = new MyModalViewController(); // UIViewController
var navigationController = new UINavigationController(modalViewController);
I want to push (make visible) little part of master page to detail page like on pictures in links below. Is it possible in Xamarin.Forms?
Before swipe
After swipe
I'll be grateful for help.
Set
<ContentPage NavigationPage.HasNavigationBar="False">
Place a StackLayout or Grid that looks like the side menu shown in your image. Add a tap gesture recognizer to it.
slMenu.GestureRecognizers.Add(new TapGestureRecognizer
{
Command = new Command(() => ShowSideMenu(masterPage)),
});
private void ShowSideMenu(MasterDetailPage masterPage)
{
masterPage.IsPresented = !masterPage.IsPresented;
}
This is possible, but requires quite some work, since you can't access the width of the MasterDetailView directly.
In another post (see How to set width for MasterDetailPage in xamarin forms ) I have described how to change the width of the MasterDetail view.
While implementing that, I came across a behaviour like you want to have, though for me it was an error.
Basically the steps would be
Implement a custom version of the MasterDetail view where you can set up a custom width
Change the width of the master view so it is a bit wider than it should be
Adapt the calculations when collapsing and expanding the view so that they don't collapse the entire width
For instance if your Master View gets a width of 340 and you want the last 40 to show, make sure that when being collapsed it "only" moves by 300
Using xamarin forms (PCL),
I searched a lot but Can not find the exact solution,
Can i change the back button in toolbar or at least should i be able to change its color and the title color as well?
I am not sure for changing back button, but I was changing back button and title color.
An example, in App.cs file OnStart method I set that LoginPage is first page with black title, on this way
MainPage = new NavigationPage(new LoginPage()) { BarTextColor = Color.Black };
Please try something like this, I have some other examples if this one doesn't work.
In the current project,I am using an UIViewController with 2 text Fields and a text area.
Text fields are used as drop-down (custom logic) and based on drop-down selection information is displayed in text area for e.g. State and city are two drop down. On click of State drop down city data is populated in second drop down and on selection of city corresponding info is fetch and displayed in Text-area.
I have a requirement to move this logic to custom popup. Can anyone guide me how to achieve this with minimal changes in Xamarin iOS.
It would use UIPopoverController in this care. You already have a view controller with all the UI elements. You can use it as the DetailViewController so you don't have to change that much. Only it's size and the background. You can use it for both iPhones and iPads.
Here you have a sample project with source code:
https://developer.xamarin.com/samples/monotouch/Popovers/
Create a new UIViewcontroller in the storyboard, set the background colour of the main view to transparent, then create another view on top of that and put in any controls you want to display etc. then in the UIViewcontrollers init method add in the following:
public OverlayView(IntPtr handle) : base (handle)
{
ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
}
That way the background view that you've set as transparent won't just show black, it'll show in the context of the screen that called it, then you just present it as you would any other view, and add in some dismiss action events if you want it to pass data back etc. Hope this helps.
I have a UIlabel that is added dynamically to a view.
What i want is a small delete button (custom image I have) to be added
to the top right corner of the label which should basically delete the label when clicked.
Can someone get me started with what kind of trick can be used to achieve this?
Infact I am open to using any other control in place of label.
Thanks a lot in advance,
Prasad.
Just make a button and then when the button is pressed:
- (IBAction)deleteLabelPressed:(id)sender {
[self.labelText setHidden:YES];
}