Can I customize UIReferenceLibraryViewController's appearance and "Done" button? - ios

I'm using UIReferenceLibraryViewController to pop up a dictionary to define certain words in my application. It's a very bare-bones controller, and I'm calling it into a smaller view on my main view (akin to a sidebar) rather than with a UINavigationController. As a result, the "Done" button that it includes does nothing when I tap it.
Can I either hide, or customize the behaviour of this Done button?
Failing that, or alternatively, could I get the contents of the definition in some format or other (HTML, XML, NSData, etc.), to display in my own way?
I do have a third-party dictionary in my app already but the definitions it gives are kinda hit-and-miss, and I'd prefer to use the Apple ones if at all possible.

From experience of a DMCA takedown notice from the dictionary provider, you cannot manipulate this view controller in any way. If you do, you are violating contracts and open yourself up to legal action.

Related

Passing data between more than 2 viewcontrollers in Swift

My app contains TabBar controller with 5 viewcontrollers. It is possible to click on a button in each of viewcontrollers which will popup another view in which user can choose a setting. The button (which was clicked) is supposed to change its background according to chosen setting in each viewcontroller. So if the user clicks on button in VC1 and chooses the setting, this information should spread into all of the other VCs so that the button has the same background.
I am using storyboards, and I know that this is easily possible between 2VCs using segues, protocols, closures... I cannot find a proper way to spread information to more than 2VCs.
The only solution I can think of is usage of UserDefaults. I would save an information about a button setting and then call ViewWillAppear in each VC, where the background of the button would be set according to the value in UserDefaults. Is there a better solution, please?
EDIT:
As #cora mentioned in the comments, I was able to solve this using Notification Center.
You have several options, including:
Pass an array of the tab controllers to your "popup settings" controller and call a "settingSelected" func in each one directly.
Using Protocol / Delegate pattern, you could create an array of delegates in your "popup settings" controller.
You can use Notification Center.
You could subclass the button and use UIAppearance proxy.
Which approach to use will depend on a number of factors, based on exactly what all you need to do (are there other "settings"? or only that button background?)
You may want to search for swift using themes to see various different approaches.
“Is there a better solution, please?”
Not necessarily. Is this in fact a user default, to be preserved between launches? Then this is exactly what user defaults are for.
If not, then at least you need some central location where information about the current button color can be stored. An obvious candidate here is the tab bar controller itself. It gets notified every time there is a tab bar item switch, so it’s a perfect candidate.
Since you have mentioned you are using a UITabbarController, you can use an instance of UITabbarController and then access .viewControllers property of it and call their added public methods to get them triggered on events that you add. Additionally, using Notification Center makes more sense to me since your code will be more readable. Sometimes Notifications can just get a little confusing for new developers who are working on your code.

How to make a floating/3D Touch style tableview?

So i'm making an application for tracking livestock. I have made a table view for the animals to go in. I have a navigation controller at the top with a button in side of it.Here is what i have so far.
I would like to have a floating table view come up when the button is pressed similar to the 3D touch menu.
Like these.
My question is how would i go about doing this. Sorry if this is a commonly done thing im pretty new to swift and xcode
If you just wanna to implement,you could search the key words as 'pop over', 'kxmenu' or 'menu' on GitHub/CocoaControls. such like this: https://github.com/zpz1237/NirKxMenu https://github.com/liufengting/FTPopOverMenu
Also, you should make it yourself. When the button is pressed, first you should create a custom window and make it key window. Secondly, add a tableView or a view contains tableView to the custom window. then, use block or delegate to deal with data communication and respond user interaction. After that, design animation you need. At last, remove subviews from custom window and make the original window key window.

How do you add the stock apple watch loading screen?

In many apple watch apps during Apple's "Spring Forward" when the apps pushed to another interface controller, they looked like this:
Then the interface controller would load
I am perfectly aware that this screen appears when the app starts up, but I want to show the stock loading screen after I push an interface controller
**I do not want to use image sequencing to achieve this
Also apple has sample code you can download called "Lister" that shows the loading symbol after every interface controller push, without image sequencing
How can you achieve this??
TL;DR
Either use the system behavior in the "Hides When Loading" checkbox under the Attributes of the Interface Controller and let the system manage it like in the example code or...
Create your own interface controller that will have to use a image sequence.
Longer Explanation
Your confusing what's actually possible. The stock loading screen isn't something that you can actually call nor manipulate. It's the default loading animation for a controller that hasn't finished awakeWithContext:. That's why you see it in the example code.
You can actually control it in the storyboard. Select or deselect the "Hides When Loading" checkbox under the Interface Controller section of the Attributes of the Interface Controller.
However, if you want control over when/where, you will have to create your own and yes that does mean you have to use an image sequence. There really isn't another way to do that animation currently without an image sequence.

How to get square hovering over button iOS

Sorry, the question isn't really clear, but basically I want a button or a label or something like that that says "notifications" and a small red square (like Facebook) that displays the number of notifications that user has (if they have any). How would I go about doing that? I'm not too advanced with UI design in iOS yet. I'm coming from an Android background so feel free to use any comparisons if there are any.
What you are referring to is called a badge. Some native controls have them (tab bar buttons come to mind), but most do not.
If you are using a tab bar controller, you can set the badge value from the UIViewController. Something like this:
[[self tabBarItem] setBadgeValue:#"1"];
If you are looking to implement a custom one, it could be easily accomplished with a UIView and a UILabel. Add a badge view to what ever view based control you are creating, then add a label to that badge view and set its text. There are probably lots of third party ones floating around the web already though.

iOS system icons and custom buttons

i'm working on my first app and the problem a have is that the application interface design is quite customised, (even though it is a tab bar based app). now in one of the view controllers i need to present the user with the print interaction controller to print images. the thing is i don't use a navigation bar or a toolbar system or otherwise. i have managed to attach a target action method to a custom button. however, apple states that the printing interface should be presented by a system button (the one that looks like an arrow, kind of). question is: is there any way of putting a system icon inside a button that is not inside a (bar)?, or would it be ok to somehow tell the user (with an overlay or something) that tapping the button i'm using (the button is a red ribbon coming down from a picture frame) they will get the printing options?
Apple says:
Although the print button can be any
custom button, it is recommended that
you use the system item-action button
shown in Figure 6-1.
I'd interpret that to mean that you can use your own button if you want to.
You might want to consider having a toolbar at the top of the view for this particular tab. Just appearing on this tab. This would make the issue moot.
You could also, have the tool bar "slide in" and "slide out" from the top to provide access to this (and other?) actions. A single or double tap could instigate such an action.
Unfortunately, Apple doesn't expose the images for the custom bar button items in any reasonable manner. If you'd like access to them, I suggest using the bug reporter system at Apple's developer site to request that.

Resources