UIApplicationShortcutIconType.Contact shows the refresh icon on xamarin.iOS in navigation bar - xamarin

I'm developing an iOS app with Xamarin.iOS.
I'm trying to put a contact icon in my Navigationitem. According to the Apple developer docs(https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/system-icons/) you have to use UIApplicationShortcutIconType.Contact.
When i'm using this I get the reply icon in my navigation bar.
Reply icon in navigation bar
And it should be this:
Contact icon
Here's my code:
NavigationItem.Title = "Menu";
NavigationItem.HidesBackButton = true;
var contactbutton = (UIBarButtonSystemItem)UIApplicationShortcutIconType.Contact;
NavigationItem.RightBarButtonItem = new UIBarButtonItem(contactbutton);
NavigationController.NavigationBarHidden = false;
Does anyone have an idea what's the problem in this case.

As you read from the documentation the UIApplicationShortcutIconType is Home Screen Quick Action Icons used for 3D touch shortcuts. We can not use it for Navigation Bar and Toolbar Icons as UIBarButtonSystemItem.
If you do want to use system style. You can only try UIBarButtonSystemItem here.
Also you can see the thread below. It posts some references we can't do this:
https://stackoverflow.com/a/43063432/8354952

Related

Xamarin forms transparent navigation bar with visible back button

I am currently trying to make a navigation page in a Xamarin Forms cross platform application that has a transparent/invisible navigation bar, but still shows a back button? Does Xamarin forms support any quick and easy way to do this?
You could do either of these two:
Option 1 : Making a Custom renderer that will customize your nav bar
Option 2 : Hiding your navigation bar and then make your own
navigation bar either stacklayout,grid, etc.
then set your navigation bar to transparent and the back button with a color
If you are using Navigation Page as your navigation paradigm, you can use:
NavigationPage.SetHasBackButton(this, false);
This will remove the back button from the navigation bar.

Xamarin.Forms how to change the navigation back button to an image?

I am building an app in Visual studio with crossed platform in Xamarin.Forms.
I have been trying to change the back arrow button in the navigation UI to an image in stead of the arrow, but I haven't found any good examples.
Is there anyone here who can help me?
Back arrow button in navigation bar is default feature. I think it can't be changed. If you want to change it then you should use a custom navigation bar.

How to override back button Title

I have a Xamarin Forms project, where the Android part is working fine. But in the navigation bar of my iOS App I have the problem that the title of some pages are too long.
So what I want to do is just replacing the title of the back button with the title of the page.
I already have a custom NavigationRenderer for some other adjustments in iOS.
In the ViewDidAppear Method of the NavigationRenderer I have tried:
NavigationItem.BackBarButton.Title = NavigationItem.Title;
NavigationItem.Title = "";
But it didn't changed anything. I also tried this with the RootController and even tried this with overriding in a custom ViewController. Nothing worked so far.
So my question is how can I accomplish this? Is the NavigationRenderer the wrong place to do it?
You generally set the back button title in the page the back button refers to i.e. the one before the page that is now showing.
NavigationPage.SetBackButtonTitle(this, "My Short Title");
So you would have to set it before you navigate to the new page if you want the new page title as the back button title.

How To Create Native Tab Bar floating above

I am a beginner. I want to create android app using intel XDK. how to implement facebook or twitter button on the menu in order to open up their web while tab bar to return to the main menu it floating above like this: fixed tab bar sample
Anyone please help me..
You can use list view or grid view template available in Intel XDK, and add iframe in the panels, the header will stay in place

Mac OSX NSStatusItem with Custom NSMenu/MenuItems AND Drag And Drop functionality

I am trying to create a Mac Application that has an NSStatusItem icon in the Status Bar. The status bar icon should support file drag and drop and must also show a menu when clicked.
The problem is that I have managed to achieve both functionalities separately and am having a hard time merging them together.
I was able to create a Status Bar Application using this link :
http://cocoatutorial.grapewave.com/2010/01/creating-a-status-bar-application/
And then I was able to achieve drag and drop functionality on the status bar icon using the following link
Drag and Drop with NSStatusItem
The problem that I am facing is as follows, in order to get drag and drop, I have to create another view and then assign that view to the NSStatusItem as shown below :
NSStatusItem *statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
ViewWithDragFunctionality* viewWithDrag = [[ViewWithDragFunctionality alloc] initWithFrame:NSMakeRect(0, 0, 24, 24)];
[statusItem.view addSubview:viewWithDrag];
Since this is just a view, it does not, obviously, behave as the NSStatusItem's default view and does not support mouse interactions or anything else.
I managed to find a way around that by adding the following function to ViewWithDragFunctionality.m
- (void)mouseDown:(NSEvent *)theEvent {
NSLog(#"Status Bar Icon Clicked");
}
The function is called whenever the status bar icon is clicked and file drag and drop is also being detected.
But now I am stuck with figuring out how to get the menu to display when clicking the status bar icon.
Any help will be much appreciated. I am working on a solution for this and will post it here if I find something first :)
Regards
Shumais
After many days of hit and trial, looking for appropriate tutorials and banging my head against the wall to no avail, I finally stumbled across an imgur application code base generously hosted on github for the public.
The code was hosted at gihthub by a user called ZBUC.
The code that helped me out is at the following repository location on github : https://github.com/zbuc/imgurBar
This is exactly what was needed, after studying how he/they did things in there and combining what I learned/found with the links mentioned in the question, I was able to create a Custom status menu item for my application, was able to get a proper menu to drop down as is the case with a default status menu item and was also able to add drag and drop functionality to my applications status menu item.
So now I have a Custom Status Menu for my application which works like a normal status menu and also supports drag and drop functionality.
I hope that the links in the question, along with the repository link posted above, are of help to everyone who needs what I did.
Thank You
Shumais

Resources