Player Modal transition like the one in Spotify - ios

I'm building a music app and I would like to make a transition like the one Spotify (and other music apps like the new Apple Music) does to present its player, a minimized player which expands an covers the main view (modally?) by dragging it or tapping it.
How can I achieve this? Is there any API or idea on how to do this?

You might want to look at open-source LNPopupController. It provides similar presentation behaviour much like the Music app.

I found a couple of cocoacontrols that might be helpful:
The first One and I think the most accurate KNSemiModalViewController, this one used in the National Geographic app its more or less what you need, you would only need to present a full screen view and remove the background animation if you want.
MWWindow Another possible solution.
MJPopupViewController
Now all of this controls dont have the "minimize" function just like spotify, the only one I found with this function is SLParallaxController, but you need to figure out how to change the map and the tableview for the content that you want, or just see how he does the dismiss/minimize animation.

Related

IOS: Smooth launch when becoming active

When my app has been inactive and I then click on it, initially it brings up the last screen it was on. Then it segues to the the entry screen.
This is a bit jarring especially because the entry screen is a New screen and if nothing is New, it, in turn, segues to yet another screen.
Is there a way to better control what happens on return to active so that it stays on the last active screen or goes straight to the entry screen without first flashing the last active screen? I imagine this may have something to do with applicationWillEnterForeground: but with no experience with this, I find Apple's documentation fairly dense going.
You want to check out state restoration, which is a way for you to implement a seamless transition to the last point the user left off. There are also great WWDC videos on it.
https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/PreservingandRestoringState.html

Create a floating GUI button on iOS home screen

I'm creating an iOS swift app that will allow users to play sounds while in another app. The app is hard to explain, but I would like to know how to create some thing like the assistive touch or the zoom controllers. Like this: http://www.phonecruncher.com/siteimage/scale/0/0/368401.gif
It's hard to explain, but as you can see there is a button on the screen (it's always on top) and the user needs to be able to open a menu from the button. The user will play the sounds from here.
Is there any way I can do this in swift in Xcode?

iOS Swift Briefly Display Info

I want to have some information drop down from the top of a view, stay on the screen for a second or two, and then go back up out of the view. I have search for displaying notifications and/or banners. All I get is either push notifications (which I don't need to use) or iAds banners.
I'm working on a barcode scanning app and I want to briefly show the value of the barcode shown without requiring the user to tap on anything. How can I accomplish this?
Don't use notifications and banners, because that might not work: the user can turn them off. In any case this is not a notification of anything, so it's a misuse of notifications.
Just do what you described, yourself: animate a view onto the screen, and then (in the animation's completion handler) use delayed performance to animate the view right back off the screen after a short delay.
You should use a view which manages its own state (INCOMING, STAY PUT, OUTGOING). This way you can reduce the memory footprint and many other bugs in the process. I coded something for a similar process. Check it out

GCD in different classes

I have an app where on start it checks the user's position and then get the weather for that spot. Mainly wind direction and speed.
It does the normal check to see it it has Intenet connection, but I found that if there is connection, but very slow the app freezes on launch screen (doing the check on startup).
I have a class that does this, which is called at startup after which a home screen is loaded.looking around, GCD seems the right way to go, but can I get the answer to be displayed in a label in the home screen when it is finished with getting the data? Main tread would have left, or rather bypassed that class and have arrived at the main screen.
Would I need to maybe use something like Notification Centre to help the label updating and re-load?
Thanks for any thoughts or code snippets.
Jorgen
PS. I am trying to keep the app iOS 5.1 to keep old iPads happy.
GCD seems the right way to go, but can I get the answer to be displayed in a label in the home screen when it is finished with getting the data? Main tread would have left, or rather bypassed that class and have arrived at the main screen. Would I need to maybe use something like Notification Centre to help the label updating and re-load?
Yes, I think you're on a very good track here. Let's keep the two issues separate, though:
After doing your background work, still in GCD, you're going to come back onto the main thread because you now want to update the interface. That's easy and straightforward.
If you have a communication problem, a notification can be an excellent solution. You can broadcast the need to update that label, and if the correct view controller exists and is listening, it will get that information.
Having said that, though, you should think about your architecture, since there may be a better way than a notification. Once you are back on the main thread, why are you not in a place where you have a way to know whether the correct view controller exist and to talk to it directly. I'm not saying the notification is bad/wrong! I've used this solution myself, and a notification is quite a standard way to come back from, say, an NSOperation. I'm just saying, give it a little thought.

Can I support VoiceOver in my Cocos2D-iPhone Game?

I'm making a game where a player reacts to sounds via motion - seeing as the visual element isn't needed to play it, and many play with their eyes closed, it seems a shame to not be fully VoiceOver compatible. I'm currently using Cocos2D-iPhone and CocosDenshion for audio, and am now starting to think about how I'll be building my menu system to choose levels and configure controls.
Is it reasonably easy to support VoiceOver in Cocos2D's menu system, or should I look in to trying to create my menus in UIKit which I have no experience using?
I don't know if Cocos' menu system supports VoiceOver, but if it doesn't, you could probably add the functionality you're looking for yourself without having to delve into a lot of UIKit work. All you need to do is create a UIView subclass which gets added to your main window when your app starts up. Then use the UIAccessibilityContainer protocol and UIAccessibilityPostNotification calls to allow users to interact with your game via VoiceOver.
The UIAccessibilityContainer protocol lets you inform VoiceOver what interface elements are currently on the screen, their labels, their traits, etc. VoiceOver then uses this information to let users swipe between elements and get feedback on them.
When your game changes state, you can change what that protocol sends back and then issue a
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil)
...to inform VoiceOver that the screen layout has changed. And to just speak something via VoiceOver, say when your game state has changed, you can send a different notification to speak some text:
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, #"Achievement unlocked!");
No need to go with UIKit framework you can go with the cocos2d native methods and class to implement this.
For sound option we have SimpleAudioEngine Which can be used. you can distinguish between sound using its ID which is of type ALuint.
ALuint soundEffectID;
//to start
soundEffectID=[[SimpleAudioEngine sharedEngine] playEffect:#"my sound"];
//to stop
[[SimpleAudioEngine sharedEngine] stopEffect:soundEffectID];
You have to mange these effect and I think your problem will be solved.

Resources