When in portrait tabgroup has a scrollbar to slide. but in landscape if length of all tabs over than width of screen. tabgroup is changing to drop-down
var win1 = Ti.UI.createWindow();
var win2 = Ti.UI.createWindow();
var win3 = Ti.UI.createWindow();
var win4 = Ti.UI.createWindow();
var win5 = Ti.UI.createWindow();
var win6 = Ti.UI.createWindow();
var tab1 = Ti.UI.createTab({
title : 'aaaaaaaaaaa',
window : win1
});
var tab2 = Ti.UI.createTab({
title : 'bbbbbbbbbbb',
window : win2
});
var tab3 = Ti.UI.createTab({
title : 'ccccccccccc',
window : win3
});
var tab4 = Ti.UI.createTab({
title : 'ddddddddddd',
window : win4
});
var tab5 = Ti.UI.createTab({
title : 'eeeeeeeeeee',
window : win5
});
var tab6 = Ti.UI.createTab({
title : 'fffffffffff',
window : win6
});
var tabgroup = Ti.UI.createTabGroup({
tabs : [tab1,tab2,tab3,tab4,tab5,tab6]
});
tabgroup.open();
how to stop changing
It's a default behavior of tab group. If you add more than five tabs, it will automatically add more tabs. You can't change this default behavior.
For more information, read this.
Related
I'm using Xamarin Auth via dependency services which presents a new view where the user authenticates However, when the modal page appears and is fully visible, it jumps up and down revealing this black bar
It quickly disapears and the page loads like so: where the top of the page is hidden. Thanks in advance
I've tried the following:
UIWindow window = UIApplication.SharedApplication.KeyWindow;
UIViewController viewController = window.RootViewController;
UIViewController AuthVC = auth.GetUI();
AuthVC.EdgesForExtendedLayout = UIRectEdge.None;
AuthVC.ExtendedLayoutIncludesOpaqueBars = false;
AuthVC.AutomaticallyAdjustsScrollViewInsets = false;
viewController.EdgesForExtendedLayout = UIRectEdge.None;
viewController.ExtendedLayoutIncludesOpaqueBars = false;
viewController.AutomaticallyAdjustsScrollViewInsets = false;
viewController.PresentViewController(AuthVC, true, null);
The UIViewController from Auth.GetUI() comes from this package: https://github.com/xamarin/Xamarin.Auth
Here is my temp fix, It still flashes but it looks correct after if has loaded. Does anyone know what would cause the black bar flashing?
viewController.PresentViewController(AuthVC, true, new Action(() =>
{
var MainUIView = AuthVC.View.Subviews[0];
var MainNavBar = AuthVC.View.Subviews[1];
var NavBarHeight = MainNavBar.Frame.Y + MainNavBar.Frame.Height;
MainUIView.Frame = new CoreGraphics.CGRect(0, NavBarHeight, MainUIView.Frame.Width, MainUIView.Frame.Height - NavBarHeight);
}));
Try this one
viewController.NavigationController.PresentViewController(AuthVC, true, new Action(() =>
{
var MainUIView = AuthVC.View.Subviews[0];
var MainNavBar = AuthVC.View.Subviews[1];
var NavBarHeight = MainNavBar.Frame.Y + MainNavBar.Frame.Height;
MainUIView.Frame = new CoreGraphics.CGRect(0, NavBarHeight, MainUIView.Frame.Width, MainUIView.Frame.Height - NavBarHeight);
}));
I have added some images in two different views & placed them inside a ScrollableView. On click of images, EventListener is not getting executed. This code works perfectly for Android(appcelerator) but for IOS it's not working.
Scroll & other Events are working fine. The problem seems with items placed in ScrollableView.
var dataView = Ti.UI.createView({
layout : 'horizontal',
top : '0'
});
var textHolderView = Ti.UI.createView({
layout : 'vertical',
width : '50%'
});
var iconView = Ti.UI.createView({
layout : 'horizontal',
width : '24.5%'
});
var header = Ti.UI.createLabel({
text : "Some Text",
font : {
fontSize : '12dp',
fontFamily : 'OpenSans-Semibold',
fontWeight : 'normal'
},
height : '38dp',
left : '15%',
color : '#000',
width : '85%',
touchEnabled : false
});
var image1 = Ti.UI.createImageView({
image : "/images/individual.png",
height : '18dp',
left : '5dp',
width : '13%',
top : '25%'
});
var slideOptionsView = Ti.UI.createView({
backgroundColor : "#1268b3",
layout : "horizontal"
});
var img_activity = Ti.UI.createImageView({
image : "/images/activity_temp.png",
height : "30dp",
width : "70dp",
left : "10%",
top : "15dp",
touchEnabled : true
});
textHolderView.add(header);
iconView.add(image1);
dataView.add(textHolderView);
dataView.add(iconView);
slideOptionsView.add(img_activity);
var scroll = Ti.UI.createScrollableView({
views : [dataView, slideOptionsView],
showPagingControl : false,
});
// Event Listeners on click for above images
img_activity.addEventListener('click', function(e) {
alert("img_activity");
});
image1.addEventListener('click', function(e) {
alert("image1");
});
$.someView.add(scroll);
$.index.open();
Thanks.
I have the Evolve Flyout Navigation Controller working on my iOS app but i'm not sure how to add icons to this code. I want an icon to display to the left of each menu item and be unique to the menu item. Here's my code:
// Subclass the component to keep the configuration in one place
using FlyoutNavigation;
namespace Mobile.iOS7
{
public class EvolveFlyoutNavigationController : FlyoutNavigationController
{
string[] MenuTasks = {
"Menu Item One",
"Menu Item Two",
"Menu Item Three",
"Menu Item Four",
};
UINavigationController notImplementedVC;
public EvolveFlyoutNavigationController () : base ()
{
// Create the navigation menu
var menuSection = new Section ();
foreach(var page in MenuTasks)
menuSection.Add(new StyledStringElement (page) { BackgroundColor = MyColors.DarkGray, TextColor = UIColor.White, Font = UIFont.FromName("Lato-Black", 16f) });
NavigationRoot = new RootElement ("Menu") {
menuSection
};
List <UINavigationController> vcList = new List<UINavigationController> ();
var mainSB = UIStoryboard.FromName ("MainStoryboard", null);
vcList.Add(new UINavigationController (mainSB.InstantiateViewController ("DashboardViewController") as DashboardViewController));
vcList.Add(new UINavigationController (mainSB.InstantiateViewController ("LocatorTabController") as LocatorTabController));
ViewControllers = vcList.ToArray ();
NavigationTableView.BackgroundView = new UIImageView (new UIImage ("bg-nav.png"));
NavigationTableView.SeparatorColor = UIColor.LightGray;
}
}
}
Any help is much appreciated!
The menu is being draw with MonoTouch.Dialog, using a StyledStringElement. This element supports an ImageUri property you can use to specify an image to display:
menuSection.Add(new StyledStringElement (page) {
BackgroundColor = MyColors.DarkGray,
TextColor = UIColor.White,
Font = UIFont.FromName("Lato-Black", 16f),
ImageUri = new Uri(__path_to_your_image__)
});
I want to implement a flyout navigation in Xamarin.iOS. For this purpose I am using the FlyoutNavigationController, which works good so far.
But now I have to display some additional content underneath the navigation list inside of the flyout-menu (basically an image, some labels and buttons). For this purpose, I wanted to use the FooterView property of the "section" control that holds the menu items.
When I set
section.Footer = "Test";
it will work (I can see the text), but when I use the 'FooterView' property, nothing shows up:
public class ViewController : UIViewController
{
FlyoutNavigationController navigation;
private const string PageNamePage1 = "The first page";
private const string PageNamePage2 = "The second page";
readonly string[] pages =
{
PageNamePage1,
PageNamePage2
};
public override void ViewDidLoad()
{
base.ViewDidLoad();
navigation = new FlyoutNavigationController
{
View =
{
Frame = UIScreen.MainScreen.Bounds
}
};
View.AddSubview(navigation.View);
var elements = pages.Select(page => new StringElement(page) as Element);
navigation.NavigationRoot = new RootElement("Induserv App");
var section = new Section();
section.AddAll(elements);
var uiTextView = new UITextView {Text = "--> This won't show!"};
section.FooterView = new UIView
{
uiTextView
};
navigation.NavigationRoot.Add(section);
navigation.ViewControllers = new UIViewController[]
{
new UINavigationController(new Page1Controller(navigation, PageNamePage1)),
new UINavigationController(new Page2Controller(navigation, PageNamePage2)),
};
}
}
Does anyone have an idea what it needs to display this footer here? Is there another way to put some controls in this panel?
Set a frame for both the footer view and uiTextView, like so:
var uiTextView = new UITextView(new RectangleF(0, 0, 10, 10)) {Text = "--> This won't show!"};
section.FooterView = new UIView(new RectangleF(0, 0, 10, 10))
{
uiTextView
};
I'm using Titanium.
I am trying to show web page with navigation bar.
I want to put Back button at the top left position inside navigation bar which works as browser's back.
Below is my current code.
Could anybody help me with this??
Thanks in advance.
var w = Titanium.UI.createWindow({
backgroundColor:'#fff',
leftNavButtonLabel:'back',});
var navGroup = Ti.UI.iPhone.createNavigationGroup({
window:w
});
var backBtn = Titanium.UI.createButton({
title:'Back',
style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED
});
var webView = Titanium.UI.createWebView({
url : 'http://gooogle.com',
canGoBack : true,
});
backBtn.addEventListener( 'click', function() {
webview.goBack();
});
w.add.setLeftNavButton(backBtn);
w.add(webView);
w.add(navGroup);
w.open();
w.navGroup.open();
Try, This... or
var main_win = Ti.UI.createWindow({
});
var w = Titanium.UI.createWindow({
backgroundColor:'#fff',
leftNavButtonLabel:'back',
});
var navGroup = Ti.UI.iPhone.createNavigationGroup({
window:w
});
var backBtn = Titanium.UI.createButton({
title:'Back',
style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED
});
var webView = Titanium.UI.createWebView({
url : 'http://gooogle.com',
canGoBack : true,
});
backBtn.addEventListener( 'click', function() {
webview.goBack();// Goes back one entry in the web view's history list. to the previous page.
});
w.add.setLeftNavButton(backBtn);
w.add(webView);
main_win.add(navGroup);
main_win.open();
for Navigation new window
navGroup.open(Window name);
for Closing last open window;
navGroup.close(Window name);