How to detect when user switches tab in CarPlay? - ios

Two sections are being generated. CarPlay automatically generates them using the data we provide from the MPPlayableContentDataSource. How can I detect when a user taps on a tab?

There is an API called beginLoadingChildItemsAtIndexPath in MPPlayableContentDataSource. You can use indexPath.length and [indexPath indexAtPosition:] to make sure which item is taped ( include tab-item )

In short: You can't. You can use the methods called on MPlayableContentDataSource (first time the tab is visible the items for that tab will be queried) and MPPlayableContentDelegate (when the user taps on an item, it's clear which tab the index path belongs to) to reason about the currently visible tab, but there is no public method that is called upon switching tabs.

Related

How to disable back operation of Flutter's Navigator class

After a login page, a page gets replaced by an overview page like so:
Navigator.popAndPushNamed( context, MyApp.ROUTE_TESTER_TASK_OVERVIEW );
This removes the current page from the Navigator's stack and pushes the new page on it. Fine.
Q: But how to I disable, that a user performs a back navigation? The user shouldn't bee able to leave the Task Overview page.
Should I keep the stack holding one and only one page all the time.
Or does Navigator has another option to disable a back navigation?
Q: Additionally, I want to disable the swipe right gesture, so than it doesn't show the previous page [as I the user clicked Android's back button].
One possible (probably not the best) solution is to wrap the second page within a WillPopScope widget. In the onWillPop parameter you can just return Future.value(false) to intercept all pop actions.

How to navigate from one dropdown menu to next dropdown menu in iOS?

In whatsapp, when we go to any particular user then at right corner there is more option (three dots menu). Then after clicking that menu, one list will come and again at last row there is navigate arrow, then after clicking on that row again new menu will come.
here is the images,
after clicking on more option, following view will appear
I want to implement this feature in my iOS Project. Anyone have any idea how to implement it ?
You can manage it with multiple ways!
First Way : Take two table view for the menu. Initially keep one tableview hidden. Then on more's click of first tableview, show second tableview and hide firt one.
Second Way : Take only one tableview and reload different data. I mean on click of main change your datasource for tableview and reload it.
DropDown menu's are considered bad practice in iOS. Use one UIAlertController to show first options, than on selecting the More show another UIAlertController.

carouselCurrentItemIndexDidChange on iCarousel only being called when I swipe

I'm using iCarousel in my Swift+Sprite Kit game, where the user has unlocked and locked items.
The locked items would display some info like current user coins, and some text that says "UNLOCK THIS FOR: X amount of coins", if the carousel item isn't locked, it won't display any of that information, just a button that says "Select".
Now, I got that working, but it will only work when i start swiping the items and not the first time the carousel shows up.
To make that work, I do it inside carouselCurrentItemIndexDidChange() method. And that obviously changes when I swipe.
How can I set the current carousel index at start so then I can force to show or not show the information depending if the item is locked or unlocked and not only when I start swiping?
To add more information about this, imagine that the user selected the item at index 4, i save that index locally. So if the user closes and opens the game, the carousel should begin at 4 not 0.
Thanks in advance.
You should set up your carousel views in viewForItemAtIndex: reusingView:. The view returned by this method should represent the current state of that carousel item; so locked or "Select" as appropriate.
If the state of an item changes then you can call reloadItemAtIndex: to have iCarousel request an updated view for that item by calling viewForItemAtIndex: reusingView:.
You can scroll the carousel to a particular item by calling scrollToItemAtIndex:animated:

How to have the iOS SearchBar Keyboard Search Button Perform an Action

I have a simple application which has a Table View (TV1) which gets populated by the user selecting a navigation bar button item to Add Entry (VC1). Within the Add Entry, when the user presses the Name field, they're taken to another Table View (TV2) which serves the purpose of allowing the user to select a previously entered name or create a new name.
TV2 is a Table View Controller with a Search Bar at the top.
Right now, existing names are available and show to the user. However, if the user "searches" for a name that does not exist, they should have the option to Create that name right now. If a search does not exist, I have a button which the user can tap which will create the user. That's simple. However, it's another tap.
Is there a way I can get the Search button of the Keyboard to perform the same functionality of the create button (i.e. Save the new user and dismiss TV1) which would then allow me to remove the Create button in the middle of the table view?
try this:
searchBar.delegate = delegateInstance;
//delegateInstance.m
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{
//perform the same functionality of the create button
}
You can catch the event fired by tapping the search button this way :
UISearchDisplayController has a UISearchBar, you can set a delegate
for search bar and implement -searchBarSearchButtonClicked:.
From now, you should be able to call the same treatment that you do on create button. Found this answer on this post. Hope that helps !
I don't think you can find a right keyboard ReturnKeyType for "Create" or "Add" to let user know the return key of the keyboard will create a user. =)
Anyway, I guess what you want is if you click "search" button second time with no search result displayed on the tableview then you want to create a user with new search text on the search bar. Did I understand right? If so, I think I already answered your question.
In UISearchBarDelegate, – searchBarSearchButtonClicked:, Check if you don't have any search results and have any text in the search bar, then you can create a user.

Is there a way to create a tabbed picker in iOS? Or somehow combine numpad + picker inputs?

I'm looking for a clean way to enable two interactions within one screen.
For example:
1) User clicks on "Add Activity" button
2) User enters a number of standard units (e.g., 10 meters), and then picks an associated activity from a list (e.g., picklist of: jog, run, walk, crawl)
All I can think of right now is creating two separate entry fields - one that calls up numpad, and another that calls up the picker. Is it possible to created a tabbed numpad so that the user completes numerical entry, then just hits 'Activity Type' above the numpad and the element switches to a picker?
Appreciate any inputs!
Not with a stock keyboard. If all you need is a numpad, you ought to be able to implement a very reasonable keyboard out of a few buttons. Add a couple of "tab" buttons, and show/hide the appropriate view: keyboard or picker.

Resources