How to disable IMA UI on iOS - swift

How to switch off entire UI of IMA (Google Interactive Media Ads)? It can't be customised so I need to turn it off and create my own.

So I could not find any better solution than to search through hierarchy and hide view manually. As IMA uses AVplayer as a container for its own ad player, I need to look through hierarchy of my AVPlayer, find IMAWKWebView and hide it. I am not big fan of this kind of solutions but as I can't find anything better at the moment, here it is:
for view in adContainer.subviews {
for subView in view.subviews {
if subView.description.range(of: "IMAWKWebView") != nil {
subView.isHidden = true
}
}
}
Where adContainer is usually your AVPlayer or anything you submit to IMAAdDisplayContainer.
I call this on STARTED event in IMAAdsManagerDelegate. It works well, however, even if I can't reproduce it now but I think it showed original UI after start for a while.

Related

Programmatically rotate Apple Watch Display

Is there any way to programmatically rotate the apple watch display 180 degrees? This would enable a person wearing an Apple Watch to orient the Apple Watch display for easier reading by a person standing opposite to the person wearing the watch.
I see this can be done via the phone using the Apple Watch App => General => Watch Orientation. There, the user can indicate which side the digital crown is situated (and that rotates the screen exactly as I'd need), But I want to code up a button directly on the watch UI that will do the same rotation trick right within my watch-app.
I've been looking at properties and methods on WKInterfaceController or WKInterfaceGroup to no avail.
Although you cannot rotate the display, if you want to make text more legible to people on the other side of the device, you can try using upside down characters to make this easier.
This answer explains how this can be done: https://stackoverflow.com/a/2995356/2035473
However, if you want more than text to be rotated, you are out of luck. This is obviously not the most optimal solution, but is as close to what you are looking for as possible in the current API. This solution will not look great, either; the text looks strange using these unicode characters, but it is still something.
I have been sitting in the Watch Lab for almost three hours and I did talk to them about the Watch. Actually, there are so many limitations. Whatever you can do, they will specify it in the following documentation which it's relatively simple compared to other SDKs they released. So, I don't think you have the control on changing the orientation manually. Have fun making watch app.
https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/
Unfortunately, there is no method to programmatically rotate the Apple Watch display in the current version of WatchKit.
If you can limit the scenario to showing an image, you could render your UI in the Watch extension then send the rotated image to the Watch. However, there is also no way to determine the orientation of the Watch, so you'd have to add manual controls.
At the end of the day, I don't think there's any realistic or user-friendly way to accomplish this with the current version of WatchKit.
I gotchu bro
import WatchKit
import Foundation
class InterfaceController: WKInterfaceController {
override func awake(withContext context: Any?) {
// Configure interface objects here.
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
WKExtension.shared().isAutorotating = true
}
override func didDeactivate() {
super.willDisappear()
WKExtension.shared().isAutorotating = false
}
}

IPhone disable/hide scrubbar mpmovieplayercontroller in fullscreen mode

I'm creating an iphone app with video clips (among other things) where I need to play one or more ads before the actual video clip. Naturally my client doesn't want users to be able to fast forward during the ads but at the same time they must be able to exit the view so I cant set controlStyle to MPMovieControlStyleNone.
I would prefer not to hack the default view and remove the scrubbar so it seems my only option is to implement a custom bar with a single "Done"/"Back" button.
I've googled my eyes out trying to find example code for this, but no dice. I've seen similar questions posted here as well but no answers are given that could help me out. I'm a novice IOS developer and could really use som help with this (custom control bar with single "Done" button for fullscreen MPMoviePlayerController that shows/hideson tap OR disable scrubbar in an acceptable fashion – in fullscreen mode).
Anyone done this before or know where to find some example code? Thanks!

Recreating the iTunes (iOS app) tableViewCell which previews songs

I'm creating an app which would provide the user with a list of audio files and let them sample a small piece of audio when they select the song (just like the iTunes iOS app).
I love the way the iTunes iOS App has implemented it (image attached); wherein I can click on a cell and the album cover flips over to show a progress indicator and a stop button. I can select a cell and the sample starts to play, and the moment I stop it, the progress indicator flips back over to show the album/song art.
I'd like to create something like that for my app. Any suggestions on how I can go ahead with it.
Thanks a ton in advance! :D
EDIT: Based on Till's suggestion, I'm adding this edit. What I wish to get by asking this question is suggestions for the best approach to make the flip animation, showing a custom view in a UITableViewCell image space, possible. Currently, I'm not worried about playing the audio or displaying the progress of the playback. I simply need suggestions on the best approach to perform the flip animation and substitute the image with a custom UIView. :) Thanks again! :D
You will need to create it. I suggest making it as a custom tablecell. If you polish it well enought, you can put it on CodeCanyon and make it worth your while.
Also, I can recommend looking at the works on http://cocoacontrols.com/ - It might not have exactly this one, but it has many interesting controls and inspirations.
This is exactly what u looking for:
https://github.com/marshluca/AudioPlayer
You can also refer to some Sources :
https://github.com/lipka/LLACircularProgressView

Walkthrough / tooltip / demo for iPhone app

I've got an app that appeals to an older demographic. The interface is simple but with some custom controls where a simple graphic is not completely self explanatory (save to playlist, sort by genre for example).
I've seen plenty of apps with great first run walkthroughs (examples here) but don't know if there are some existing libraries out there.
Your suggestions are welcome.
I found CMPopTipView that, while it doesn't fit my needs completely may be of use to those that are looking to pop a tool tip every now and then.
Most of these overlays/walkthroughs can be accomplished by adding a subview to the main window of your app. There are some edge cases to take into account, but for the most part, you need to simply grab a reference to the key window with
UIWindow* keyWindow;
keyWindow = [UIApplication sharedApplication].keyWindow;
You then would add your overlay view as a subview with:
[keyWindow addSubview:anOverlayView];
Handling taps to dismiss the overlay can be done with a tap gesture recognizer.
If you are looking to create a click-through demo which runs in the browser and on mobile devices, AppDemoStore is the right tool for you. You just have to upload some relevant app screenshots, add hotspots for the navigation between the screens and callouts for explanations. It takes only a couple of minutes and it's free.
Regards,
Daniel

Create an updating animation similar to the facebook iphone app

I have a scrollview with all my data to be showed and I want the user to trigger it being updated. The user should pull the scrollview downwards, then a small view will be shown that was previously hidden and that says: "updating" or "release to update".
Look at the iPhone facebook app and you will see what I am talking about.
They did it pretty awesome, they have a small animation that and an arrow that makes it easy and intuitive.
However when trying to replicate this behaviour I have found that the UI is blocked until the scrollview delegate function was run. This is impractical because I want to update the UI from that scrollview delegate function.
So when the user holds the scrollview in a dragging motion, there should be a small animation or so that tells him to release it or hold it longer.
- (void) scrollViewDidScroll:(UIScrollView *)scrollView
{
CGPoint topOffset = CGPointMake(0, 20);
if (self.contentOffset.y < 0 )
{
labelUpdate.text = #"Release to update.";
//do something here to update the UI
}
}
Search google for pull down to refresh
I would recommend you look into the Three20 library. Chances are that functionality has been incorporated into that library so you don't have to make it from scratch. (I haven't looked into the Three20 library for awhile so I can't confirm or deny this for sure, sorry.)
You might want to use an existing framework. A couple of them are mentioned here.
Three20's TTTableViewController
The first time I saw this functionality was in the Tweetie(now Twitter) app and now the Facebook app. The first developer of the Facebook app created an open Framework called Three20 and coincidentally Three20's framework has a demo twitter app on github. To use the 'pull to refresh' functionality though you might have to use Three20's TTTableViewController which uses url paths to keep track of navigation so you might have to adapt your app to use that but there are plenty of tutorials for Three20 like this one.
Thanks for all the answers,
ultimately I have chosen this solution:
https://github.com/leah/PullToRefresh
because it simple and it works. Additionally I have refactored the ViewController shown there into a simple UIView type that you can comfortably use with any UIScrollView derived class.
A link with code will follow shortly.