clancey / flyoutnavigation Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
I fixed it in one of my commits but I can't send you a pull request because I changed another thing with the MonoTouch.Dialog reference you don't want to have in your repository.
Maybe there is a better solution but this worked for me:
chr1gu@b02a9a6
Maybe you can chery-pick this thing
Clancey, I need to update a WebView map based on what is toggled in a list. My idea is to use your slide-out menu to provide the functionality, and change the standard controls to be toggle switches. Any tips on how I might do that? Thanks!
Dear all.
I can not seem to understand how to change the following code to already existing viewcontrollers ( such as timetableViewController and optionsViewController(I have made them myself):
var navigation = new FlyoutNavigationController
{
// Create the navigation menu
NavigationRoot = new RootElement("Navigation") {
new Section ("Pages") {
new StringElement ("Animals"),
new StringElement ("Vegetables"),
new StringElement ("Minerals"),
}
},
// Supply view controllers corresponding to menu items:
ViewControllers = new[] {
new UIViewController { View = new UILabel { Text = "Animals (drag right)" } },
new UIViewController { View = new UILabel { Text = "Vegetables (drag right)" } },
new UIViewController { View = new UILabel { Text = "Minerals (drag right)" } },
},
};
// Show the navigation view
navigation.ToggleMenu();
View.AddSubview(navigation.View);
Does anybody have any idea?
I need transparent bg in UITableViewCell (Menu). As you know in iOS 7 for transparent row we should do it programmatically (cell.backgroundColor = UIColor.Clear); Can we do it for this?
First of all, thanks for a great component!
Unfortunately in complex layouts I am running into issues with view constraints. In my ViewControllers, I often use a Style Sheet of sorts to set my views correctly since I often add and remove views programmatically. Though everything works with the FlyoutNavigation Menu correctly, I get weird errors when I rotate. This is very likely due to the way that I create the views using the style sheet.
Here is the Error:
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"NSAutoresizingMaskLayoutConstraint:0x100ec920 h=-&- v=&&- UITableView:0xe95c600.width == UIView:0xc2b0d80.width - 1222",
"NSAutoresizingMaskLayoutConstraint:0x100f53c0 h=-&- v=-&- UIView:0xc2b0d80.width == UIView:0xc2aa780.width + 448",
"NSAutoresizingMaskLayoutConstraint:0x1003cfb0 h=-&- v=-&- UIView:0xc2aa780.width == UIWindow:0xc29aeb0.width",
"NSAutoresizingMaskLayoutConstraint:0xc028970 h=--- v=--- H:[UIWindow:0xc29aeb0(768)]"
)
Will attempt to recover by breaking constraint
NSAutoresizingMaskLayoutConstraint:0x100ec920 h=-&- v=&&- UITableView:0xe95c600.width == UIView:0xc2b0d80.width - 1222
The constraint that actually throws the error is actually a FlyoutNavigation.NavigationTableView-Width Constraint. The debugger fixes it correctly so everything works, but it is clearly still an issue.
Other Details:
--Only happens on iPad.
--My "Style Sheet" is based on the UIScreen.MainScreen, See below:
public StyleSheet ()
{
}
public static RectangleF GetViewFrame()
{
RectangleF frame = UIScreen.MainScreen.Bounds;
if (IsLandscape) {
float tempHeight = frame.Height;
frame.Height = frame.Width;
frame.Width = tempHeight;
}
frame.Height = frame.Height - statusBarHeight;
return frame;
}
Hello James,
Tried the example of the FlyOutNavigation after the viewing the seminar (nicely done!)
But i don't see the button on the left side?
Any idea?
Thanks in advance,
Danny
Hi,
I am using the Flyout navigation controller in my app and it works perfectly except for one small issue. I have a tableview and Im using the Swipe to delete option (using CommitEditingStyle and CanEditRowAtIndex methods), but when I swipe i dont see the delete option. In simulator i sometimes can see the swipe option but on phone i couldnt get this to work. Without flyout navigation it works fine. Any workarounds to fix this?
Hello, I am using Flyout Navigation for a ipad app I'm working on. In the mastview controller, when I click on an element, it highlights in grey before the menu closes and remains grey when the user opens the menu again. I cannot seem to find a way to change the color from grey. Can anybody help with this?
Let's say on a certain screen we want to hide a menu item because it doesn't apply to that screen, or maybe we just want to disable it.
Is there a way to access a specific menu item index? Is there a Hide() method or an Enable property?
When using google maps on a ViewController which uses the component the Slide out gesture of the component seems to disable any touch events reaching the map. This is only happening in IOS7, removing the GestureRecognizer from the Flyout view fixes the issue.
Flyout navigation has been working fine.But after I converted my code into unified. I got a problem in my app which contain login screen. after we login, the flyout navigation table view click(row click) is not working(unable to move next view controller) but if I went to new presentviewcontroller(i.e card.io) and come back its working fine.
Please find the below code.
I'm calling homeController from LoginController
using below code
Home homeObject=new Home();
this.NavigationController.PushViewController(this.homeObject,true);
Home
FlyoutNavigationController myflyout = new FlyoutNavigationController ();
UIView background = new UIView ();
background.ContentMode = UIViewContentMode.ScaleAspectFill;
background.Add (bg);
UIImageView bg = new UIImageView (new CGRect (0f, 0f,
View.Bounds.Width, View.Bounds.Height));
bg.Image = imgBackground;
bg.ContentMode = UIViewContentMode.ScaleAspectFill;
myflyout.NavigationTableView.BackgroundView = bg;
myflyout.NavigationTableView.RowHeight = 44;
myflyout.NavigationTableView.SectionIndexBackgroundColor =
UIColor.Clear;
myflyout.NavigationTableView.SectionIndexColor = UIColor.White;
myflyout.NavigationTableView.SeparatorStyle =
UITableViewCellSeparatorStyle.None;
myflyout.NavigationTableView.SectionHeaderHeight = 20;
myflyout.NavigationTableView.Frame = new CGRect (0f, 250f,
View.Bounds.Width, View.Bounds.Height);
myflyout.NavigationTableView.TintColor = new UIColor (1, 1, 1, 1);
myflyout.NavigationRoot = new RootElement ("Home") {
new Section ()
{
GetMenuItem ("Single Item Payment", imgSinglePay),
GetMenuItem ("Multi-items Payment", imgMultiPay),
GetMenuItem ("Shopping Cart Setup", imgCartSetup),
GetMenuItem ("Tax and Tips Setup", imgBillSettings),
GetMenuItem ("History", imgHistory),
GetMenuItem ("BitCoin History", imgHistory),
GetMenuItem ("Reports", imgReports),
GetMenuItem ("Settings", imgSettings),
GetMenuItem("Business Logo",imgUpload),
GetMenuItem ("Change Password", imgChangePassword),
GetMenuItem ("Help", imgHelp),
GetMenuItem ("Support", imgSupport),
GetMenuItem ("Donate to charity", imgDonate),
GetMenuItem ("Logout", imgLogout)
}
};
myflyout.ViewControllers = new []
{
new MainPage (SellerToken, this, mailid, userid, flyout)as
UIViewController,
new CartView (SellerToken, this, mailid, userid, flyout)as
UIViewController,
new AddCategory (flyout)as UIViewController,
new BuildSettings (flyout)as UIViewController,
new History (username, password, this, mailid, CustomerID,
userorgid, flyout)as UIViewController,
new Bitcoinhistory (username, password, this, mailid, CustomerID,
userorgid, flyout)as UIViewController,
new SalesProductChart (flyout)as UIViewController,
new Debit_Settings (userid, username, password, phoneno, mailid,
dob, SellerToken, this, flyout)as UIViewController,
new UploadMerchantLogo (flyout)as UIViewController,
new Changepassword (username, this, flyout)as UIViewController,
new Debit_table_help (this, flyout)as UIViewController,
new Support (userid, mailid, phoneno, this, flyout),
new DonateCharity(mailid,flyout)as UIViewController,
new UINavigationController (new Loginpage (this, "logout"))
};
View.AddSubview (myflyout.View);
View.Add (statusview);
please help me to solve this.
hi I have a doubt.. I'm using the new control FlyoutNavigation, its fine, but I dont know ho to use it with differents ViewControls....
I have 5 View controls (vc1, vc2, vc3, ecc) and maincontrol (uiviewcontrol which contain the FlyoutNavigation)
navigation = new FlyoutNavigationController (); navigation.View.Frame = UIScreen.MainScreen.Bounds;
navigation.NavigationRoot = new RootElement ("") { new Section(header) { new MenuStringElement("Menu1"){...}, new MenuStringElement("Menu2"){...}, new MenuStringElement("Menu3"){...}, } };
navigation.ViewControllers = new UIViewController []{ new UINavigationController(new vc1 ()), new UINavigationController(new vc2 ()), new UINavigationController(new vc3 ()),
}
but this is not correct.... have some problem with NavigationController in those UIViewcontrol and others problem.
what is the correct approach for this development? tks!
It would be nice to pass the style of the NavigationTableView into its constructor in order to have a grouped DialogViewController.
I want to add UIViewController and UITableViewController to FlyoutNavigationController.
Can anyone please explain how to add?
Sample code please.
Flyout navigation has been working fine.But after I converted my code into unified. I got a problem in my app which contain login screen. after we login, the flyout navigation table view click(row click) is not working(unable to move next view controller) but if I went to new presentviewcontroller(i.e card.io) and come back its working fine.
Please find the below code.
I'm calling homeController from LoginController
using below code
Home homeObject=new Home();
this.NavigationController.PushViewController(this.homeObject,true);
Home
FlyoutNavigationController myflyout = new FlyoutNavigationController ();
UIView background = new UIView ();
background.ContentMode = UIViewContentMode.ScaleAspectFill;
background.Add (bg);
UIImageView bg = new UIImageView (new CGRect (0f, 0f,View.Bounds.Width,View.Bounds.Height));
bg.Image = imgBackground;
bg.ContentMode = UIViewContentMode.ScaleAspectFill;
myflyout.NavigationTableView.BackgroundView = bg;
myflyout.NavigationTableView.RowHeight = 44;
myflyout.NavigationTableView.SectionIndexBackgroundColor =
UIColor.Clear;
myflyout.NavigationTableView.SectionIndexColor = UIColor.White;
myflyout.NavigationTableView.SeparatorStyle =UITableViewCellSeparatorStyle.None;
myflyout.NavigationTableView.SectionHeaderHeight = 20; myflyout.NavigationTableView.Frame = new CGRect (0f, 250f,View.Bounds.Width, View.Bounds.Height);
myflyout.NavigationTableView.TintColor = new UIColor (1, 1, 1, 1);
myflyout.NavigationRoot = new RootElement ("Home") {
new Section ()
{
GetMenuItem ("Single Item Payment", imgSinglePay),
GetMenuItem ("Multi-items Payment", imgMultiPay),
GetMenuItem ("Shopping Cart Setup", imgCartSetup),
GetMenuItem ("Tax and Tips Setup", imgBillSettings),
GetMenuItem ("History", imgHistory),
GetMenuItem ("BitCoin History", imgHistory),
GetMenuItem ("Reports", imgReports),
GetMenuItem ("Settings", imgSettings),
GetMenuItem("Business Logo",imgUpload),
GetMenuItem ("Change Password", imgChangePassword),
GetMenuItem ("Help", imgHelp),
GetMenuItem ("Support", imgSupport),
GetMenuItem ("Donate to charity", imgDonate),
GetMenuItem ("Logout", imgLogout)
}
};
myflyout.ViewControllers = new []
{
new MainPage (SellerToken, this, mailid, userid, flyout)asUIViewController,
new CartView (SellerToken, this, mailid, userid, flyout)asUIViewController,
new AddCategory (flyout)as UIViewController,
new BuildSettings (flyout)as UIViewController,
new History (username, password, this, mailid, CustomerID,userorgid, flyout)as UIViewController,
new Bitcoinhistory (username, password, this, mailid, flyout)as UIViewController,
new SalesProductChart (flyout)as UIViewController,
new Debit_Settings (userid, username, password, phoneno, mailid, flyout)as UIViewController,
new UploadMerchantLogo (flyout)as UIViewController,
new Changepassword (username, this, flyout)as UIViewController,
new Debit_table_help (this, flyout)as UIViewController,
new Support (userid, mailid, phoneno, this, flyout),
new DonateCharity(mailid,flyout)as UIViewController,
new UINavigationController (new Loginpage (this, "logout"))
};
View.AddSubview (myflyout.View);
View.Add (statusview);
please help me to solve this.
Just started targetting IOS 7 in Xamarin Studio and found that items at top of flyout menu is hidden behind the top navigation bar and IPhone clock.
Is there an update or quick fix for this?
When I use the FlyoutNavigation, i have an empty space on top of my app (the NavigationBar of the NavigationController).
To hide this, I can just set NavigationBar.NavigationBarHidden = true.
The issue now is, that if I have detail pages, where I want to use the NavigationBar (for swipe-back navigation etc.), I have to NavigationBarHidden = false again etc., which produces ugly effects for the user.
Is there a possibility to have the header of the main views (the ones listed in the menu) in the NavigationBar? Or is there an even better solution to this?
Regards & thanks for the help,
Marcel
Hi,
Is there any way to show image for menu Items?
Best Regards,
Not sure how easy this would be without subclassing the actual root controller to be used, but it would be nice to have the option to use a swipe to left gesture, to bring the root view controller back into view, hiding the flyout view controller...
When starting in landscape mode on the ipad, the menu is hidden and the swiping doesn't work correctly.
It should work when the following are added to ViewWillAppear
if (this.ShouldStayOpen && !this.IsOpen) {
ShowMenu();
}
Hi all
This is less an issue and more a question, is it possible to control how far the content slides over when opening the Menu? Since the last update it seems the menu is pulling out much further than it used to and I can't figure out what I should update in the source to reduce this width.
Cheers
UPDATE: Scratch this, found the menuWidth value..
In the FlyoutNavigationSample app, the nav bar height does not shrink/grow when the iPhone is rotated to/from landscape orientation. The nav bar behavior can be corrected by introducing the concept of a "target view controller" and changing the FlyoutNavigationController as follows:
Add the gesture recognizer to the target controller, rather than the flyout controller.
In NavigationItemSelected, add the selected controller (and its View) to the target controller (and its View). E.g.,
this.TargetViewController.View.AddSubview (mainView);
this.TargetViewController.AddChildViewController (CurrentViewController);
In IOS 7, if one of the view contains a UIScrollView (you can try also with a DialogVIewController), inside this UIScrollView the open gesture swipe to right is not opening the menu anymore :(
I found this problem also with other controls such as UITextView. I guess is a problem about all controls based on a UIScrollView
Hi there,
Is there a way to customize the cell of the NavigationTableView?
Actually, I just add a BackgroundView to NavigationTableView but now I want to customize the VisibleCells Bound but do not know if it is possible.
Actually I am doing this
foreach (var view in navigationController.NavigationTableView.VisibleCells) {
var cell = view;
cell.TextLabel.TextColor = UIColor.White;
var boundsCell = cell.Bounds;
cell.Bounds = new RectangleF (boundsCell.X, boundsCell.Y, boundsCell.Width, boundsCell.Height * 5);
}
but the changes does not take place.
Can you help me with it?
I am using the FlyoutNavigation component in my project and it works well. But I have a small issue when using it with the Segment view control. In one of the views I use a segmented view control and added a gesture recognizer to swipe the segmented pages. But the swipe does not work when the view that im using is in Flyout navigation. (But when I use the gesture recognizer in a separate sample, where i do not use Flyout navigation it works perfectly.The swipe right and left allows to scroll between segments). Is this a known issue with Flyout navigation? Any hints to work around this?
Not sure how to disable the flyout navigation based on the API available.
There is a navigation.ShouldReceiveTouch but I'm not sure how to use it to disable the flyout from being used.
Thanks.
base.ViewDidLoad ();
var navigation = new FlyoutNavigationController {
// Create the navigation menu
NavigationRoot = new RootElement ("Navigation") {
new Section ("Pages") {
new StringElement ("Animals"),
new StringElement ("Vegetables"),
new StringElement ("Minerals"),
}
},
// Supply view controllers corresponding to menu items:
ViewControllers = new [] {
new UIViewController { View = new UILabel { Text = "Animals (drag right)" } },
new UIViewController { View = new UILabel { Text = "Vegetables (drag right)" } },
new UIViewController { View = new UILabel { Text = "Minerals (drag right)" } },
},
};
// Specify navigation position
navigation.Position = FlyOutNavigationPosition.Left;
// Show the navigation view
navigation.ToggleMenu ();
View.AddSubview (navigation.View);
How do I set the Navigation Bar styles like background color, title, left icon etc? Is there a way to navigate from one view controller to other via UIButton in the first view controller?
I was previously using a UINavigationController to switch between screens.
With FlyoutNavigation, how can I change screen without tapping directly on the navigation menu?
Let's say I press a button in my current screen that should take me to another screen..
Thanks
Hi there,
Im just looking at customizing your flyout menu. For those elements which I have overriden the UITableViewCell.GetCell methods, that all works fine. Colours, images etc all working as expected. The issue that I am having now now is when the user swipes the navigation menu up or down fast, it defaults to the original styles. Not sure if its an issue with the default UITableViewor the refresh logic of your component. Let me know if you can replicate it.
We have implemented Flyout navigation in our product and it is working very well. We were trying to add Pull to Refresh feature on one of the table views and the refresh control is not working when the controller is called from Flyout navigation and works otherwise.
Can you please let us know if there is a way to enable pull to refresh when Flyout navigation is used.
Let's say you have a menu item in the left that has nested items, such as:
flyout.NavigationRoot = new RootElement(string.Empty)
{
new Section()
{
new ImageStringElement("Book", NavigateToBook, Theme.PanelIconBook),
new ImageStringElement("Activities", NavigateToActivities, Theme.PanelIconActivity),
new ImageStringElement("Notes", NavigateToNotes, Theme.PanelIconPencil),
new ImageStringElement("Bookmarks", NavigateToBookmarks, Theme.PanelIconBookmark),
new ImageStringElement("Presentations", NavigateToPresentations, Theme.PanelIconPresentation),
new RootElement("Settings")
{
new Section()
{
new StringElement("Change Password"),
new StringElement("Log Out"),
}
},
},
};
The bottom "Settings" item appears modally because MonoTouch.Dialog can't find a valid NavigationController to push to. This isn't proper iOS navigation for nesting elements, it looks kind of strange.
Making FlyoutNavigationController a UINavigationController might be a way to support this, but I'll leave the implementation details up to you.
Can't get a subview controller to elegantly perform a segue on the main containing controller (see below)?
NavigationRoot = new RootElement ("Navigation") {
new Section ("Menu") {
new StringElement ("Mapview Controller"),
new StringElement ("Another View Controller"),
}
},
ViewControllers = new [] {
// mapview is a view inside this viewcontroller and able to perform segues
new UIViewController { View = mapView },
// this is a seperate viewcontroller but is embedded inside the flyoutNavigation
// AnotherViewController cant seem to call the root navigation controller (<-- actually a uiNav inside a tab bar nav) so i can perform a segue movement just like the above mapViewController??
this.Storyboard.InstantiateViewController("AnotherViewController") as AnotherViewController,
},
// sub viewcontroller i.e. AnotherViewController trying to move mainViewController to perform a segue..
// throws error: Receiver (<FlyoutNavigation.FlyoutNavigationController: 0x14360600>) has no segue with identifier 'segueTest'
this.ParentViewController.PerformSegue("segueTest", this);
Flyout navigation has been working fine.But after I converted my code into unified. I got a problem in my app which contain login screen. after we login, the flyout navigation table view click(row click) is not working(unable to move next view controller) but if I went to new presentviewcontroller(i.e card.io) and come back its working fine.
If you use Facebook's app as an example, the view controller that's partially shown on the right, when the flyout is visible, cannot actually be interacted with. Tapping anywhere on that view controller causes the flyout to be hidden. It would be nice to have this as an option, so that the user wouldn't have to press the left navigation button again to hide the flyout, but rather could press anywhere on the right side...
Could you change some of the main private methods in FlyoutNavigationController to protected.
I'm just trying to extend the class so I have control over whether or not the first view is automatically displayed when I set the ViewControllers but I'm ending up having to copy over a lot of your methods so they are visible to my class.
I found two issues in the code:
If you comment out the "if (IsOpen || ShouldStayOpen)" part the issue disappears.
I hope this is somehow helpful. If you want I can prepare a pull request for you. But I don't know what approach will you choose to solve that things.
Window.RootViewController = new MainController ();
Inside MainController is the FlyoutNavigationController as well as the InboxViewController being added as a view.
// Adding the Inbox to the menu.
controllers.Add (new UINavigationController (new InboxViewController()));
navigation.ViewControllers = controllers.ToArray ();
// In InboxViewController
public override void ViewWillAppear (bool animated) {
base.ViewWillAppear (animated);
UIToolbar toolbar = new UIToolbar (new RectangleF (0, View.Frame.Size.Height - 44, View.Frame.Size.Width, 44));
this.tableView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;
toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth;
UIBarButtonItem doneBtn = new UIBarButtonItem(UIBarButtonSystemItem.Compose, OnComposeClicked);
toolbar.Items = new UIBarButtonItem[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), doneBtn, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) };
View.Add (toolbar);
}
Doing it this way, the toolbar will not show up properly at the bottom of the screen (overlayed over the tableview).
If doing it regularly.
Window.RootViewController = new UINavigationController (new InboxViewController ());
Toolbar shows up at the bottom of the screen like normal.
please supoort iOS7
After doing some testing with Flyout noticed that slows with TableView's (UITableViewStyle.Grouped) to finish loading the screen and make the gesture changing to another view Flyout seems that the transition is slow.
public override void ViewDidLoad () {
base.ViewDidLoad ();
this.NavigationController.NavigationBar.Hidden = true;
navigation = new FlyoutNavigationController ();
navigation.View.Frame = UIScreen.MainScreen.Bounds;
View.AddSubview (navigation.View);
//Menu
navigation.NavigationRoot = new RootElement ("Home") {
new Section ("Home") {
from page in Menu
select new ImageStringElement(page, UIImage.FromBundle("listicon.png")) as Element
}
};
navigation.ViewControllers = new []
{
new UINavigationController(new ViewController1(navigation)),
new UINavigationController(new ViewController2(navigation)),
new UINavigationController(new ViewController3(navigation)),
new UINavigationController(new ViewController4(navigation))
};
}
Where ViewController(N) inherit from UITableViewControllers.
Hi,
Do you know if it is possible to have both a left sidebar and a right sidebar ?
Currently I am only able to make a left sidebar.
Thanks in advance.
Is it possible?
please add right gesture flyout like facebook app.
i add GAdmob in the FlyoutNavigationController.
it will cover the admob bannerview
example:
var navigation = new FlyoutNavigationController {
.....
}
View.AddSubview (navigation.View);
navigation.Add(bannerview);
bannerview.RootViewcontroller=nav;
i start my app it will be normal.
but i select other view ,,then other view will cover the admob bannerview.
what can i do for this issue?
If you close the menu by dragging to the left and don't let go before the finger slides off the phones left side, the closeButton will stay 'visible' and thus disable buttons etc. in the right side of the phone. E.g. the top-right button in a navigationbar or disclosure buttons in a UITableView.
The problem seems to be HideMenu() and can be solved by replacing:
public void HideMenu()
{
if (mainView.Frame.X == 0)
return;
with:
public void HideMenu()
{
if (mainView.Frame.X == 0)
{
closeButton.RemoveFromSuperview();
return;
}
When the flyout button is hit, it crashes. Issue is here:
public void ResignFirstResponders(UIView view)
{
if (view == null || view.Subviews == null)
return;
foreach(var subview in view.Subviews)
{
if (subview.IsFirstResponder)
subview.ResignFirstResponder();
------> ResignFirstResponders(subview);
}
}
I've added the IF checked at the top, which should also fix it. doing a bug - not a PR - 'cos my iOS7 and X.iOS stuff is broken at the moment (yay mono 3.1)
If you want to use this controller in a storyboard, these are required.
I have an odd behavior I'm trying to track down, and I'm not sure if it is FlyoutNavigation or something else I'm doing. Maybe someone can take a quick look who understands things a bit better than I do.
Example Project - https://github.com/benhysell/FlyoutNavigationWithNSLayoutConstraintsError
Goal - Use https://gist.github.com/praeclarum/5175100, A C# syntax for NSLayoutConstraints, described in this blog post, http://praeclarum.org/post/45690317491/easy-layout-a-dsl-for-nslayoutconstraint, with FlyoutNavigation.
Issue - On the first use of a view that incorporates NSLayoutConstraints the view doesn't respect the constraints or background color, both odd. On subsequent 'selections' of the view from the menu of FlyoutNavigation the view will properly draw.
Setup - Working in Xamarin Beta Channel against iPhone Simulator 6.1 and the latest released Xcode.
Steps to Reproduce
The easiest way to show this is to open the sample project that comes with FlytoutNavigation and modify this project using the steps below. I included in this post a link to the example project I modified to show the error.
Add the gist, https://gist.github.com/praeclarum/5175100, to a new class, call it layout.
Add a new UIViewController and the following to ViewDidLoad(), note this was modified from the Xamarin 'Hello World' sample app one can create in VS2012
public override void ViewDidLoad()
{
base.ViewDidLoad();
View.Frame = UIScreen.MainScreen.Bounds;
View.BackgroundColor = UIColor.Red;
button = UIButton.FromType(UIButtonType.RoundedRect);
button.SetTitle("Click me", UIControlState.Normal);
button.TouchUpInside += (object sender, EventArgs e) =>
{
button.SetTitle(String.Format("clicked {0} times", numClicks++), UIControlState.Normal);
};
View.AddSubview(button);
const int ButtonWidth = 75;
const int HPadding = 22;
const int VPadding = 44;
View.ConstrainLayout(() =>
button.Frame.Width == ButtonWidth &&
button.Frame.Left == View.Frame.Left + HPadding &&
button.Frame.Top == View.Frame.Top + VPadding);
}
In the MainController.cs replace
navigation.ViewControllers = Array.ConvertAll (Tasks, title =>
new UINavigationController (new TaskPageController (navigation, title))
);
with
navigation.ViewControllers = Array.ConvertAll(Tasks, title =>
new UINavigationController(new MyViewController(navigation))
);
I'm saying 'make every view a view that implements NSLayoutConstraints'.
this.View.AddSubview (mainView);
ViewControllers[0].ChildViewControllers[0].View.Frame {{X=160,Y=208,Width=0,Height=0}} System.Drawing.RectangleF
This is the incorrect size for the view, however after I step over line 238:
ViewControllers[0].ChildViewControllers[0].View.Frame {{X=0,Y=0,Width=320,Height=416}} System.Drawing.RectangleF
The position is fixed, and the view will draw correctly.
Summary
I've tried using the gist with the NSLayoutConstraints by itself in a single page window application without issue, and I'm thinking since it does eventually draw properly after a second invokation of FlyoutNavigation I'm thinking there is a 'something' I'm missing with the FlyoutNavigation, or setting incorrectly that I can't put my finger on.
I have got the latest source code.
If I drag menu up in Sample project it overlaps the Carrier name.
What is wrong?
Thanks
Slava
I don't know how, but is anyone planning on supporting windows phone? The Facebook has a good working example in it, although I have yet to find code to explain how they did it.
Not so much an issue, more of a request/question.
How can I change the UITableViewCell background color? I changed the TableView background color, but I can't change the Cell.
NavigationTableView.BackgroundColor (Only change the tableview color)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.