Possible to have multiple buttons in a StatusItem on MacOS? - swift

I'm trying to build a timer app on MacOS that would show the remaining time in the status bar.
Wondering if it's possible to show multiple buttons there at once? E.g. show play/pause button, reset button and the time right in the status bar.
Or are there any hacks possible, like make it a single button with 2 icons next to each other, and check the click position to see which "button" got the click?
I know I can put the extra buttons in a popover, but I'm new to MacOS dev and trying to understand the limits. Thanks!

Related

Hide buttons in Touch Bar depending on a condition

I just got a new MacBook Pro with a Touch Bar and I wanted to create an extension specific for Angular apps.
The purpose of the extension was to provide some buttons on the Touch Bar so the user can like, generate a component or rather launch the 'ng serve' command or something else.
My question here is : is it possible to hide some buttons on the Touch Bar depending on a condition, like if I'm on a Angular project or not ?
I have tried things but none of them worked.
Thank you for your time.

How to show toolbar window when clicking on statusbar in an OSX app?

I am working on an OSX app which is mainly a toolbar app. This app also prowides a status bar. This status bar is mainly to display some data, and has no menu.
Now I want to add the possibility that, when the status bar is clicked, the toolbar window gets to the front. As far as I found out, this is done like:
NSApp.activate(ignoringOtherApps: true)
What I haven't found yet is how I get my statusbar item to perform that. I created a function, and tried it with statusitem.perform, but that doesn't work.
Thanks,
Jack

How to show number small custom icon like mail, iphone

I have a social networking app. I have a button and based on the click on the button I need to show a small icon on the top right corner of the button. it is a custom color and text.
I know to show the default system number icon for like the one for unread mail you can get it from the shared application badge count. But I am trying to do something custom here.
I am thinking of building my own imageview (its background will be a custom png) and then within it a small text to show the number.
Anyone has experience with this and can recommend a better way?
You can add a imageView with badge image as the subvie of that button.
There is a lot of custom badge controls available.
Please check the following links.
jobadgeview
CustomBadge
Badge
You cannot change anything on the home screen besides for the app icon, name, and badge value. Do you mean on the home screen or on a tab bar?
UPDATE
If you mean a badge in the app, not on the homescreen, checkout #MidhunMP's answer to find links on how to do this. I have used http://www.spaulus.com/2011/04/custombadge-2-0-retina-ready-scalable-light-reflex/?lang=en before successfully.

iPhone: hide address bar, also if user clicks top of screen or clock/battery bar

I want the address bar to disappear on the iPhone. So far I have used:
window.scrollTo(0, 1);
This hides the address bar when the page is first loaded.
Then I have
document.body.addEventListener('touchmove', function(e){ e.preventDefault(); });
This prevents the user from scrolling back up to the address bar (or anywhere else) while still allowing buttons to be tapped.
But, the address bar still appears when I tap the top of the page. Not sure if this is because I am touching the top of the webpage or because I am touching the bar with the clock and battery.
I'm guessing that the user himself would need to set this option on his phone, although it would be nice if I could control it via the webpage. Is either way possible?
Why? I want to make a web app for a disabled child who has a hard time controlling his movements. I essentially want to turn off any touch actions that aren't related to the web app itself. Otherwise he will accidentally set off lots of unwanted actions. Not sure if this is possible.
I'm afraid you can't hide the status bar. For example in iOS 6 you can, in landscape mode, go full screen, it hides the status bar, but there is a new button at the bottom right of the screen to leave the full screen mode.
What you are asking is not achievable within Safari. But you can develop a simple application full screen (no adress bar, no buttons, no status bar) with a simple UIWebView. This way there will not be any unwanted action.

it is possible to make call on button click and show our own view rather then default?

I want dial a number on button click and don't want to show that six options(sound,mute..etc) which are provided by iphone by default but i want to show my own view or option at calling time. is it possible?
If you are talking to modify the phone calling screen then You can't....