Creating a Note Editor with Apple Pencil functionality? - ios

Does anyone know how to make Apple Pencil work well in the context of a UITextView? For example, using the Apple Pencil with TextKit to create a 'drawing space' that expands as the user draws more within the UITextView. Just like in the Notes app.
I thought PencilKit (announced at wwdc) would handle this but it looks intended more for situations where only apple pencil interactions occur - correct me if I am wrong. I want to do exactly what is done in the Notes app. I don't think PKCanvasViews would work, as the user could create many of them in a single UITextView. PKCanvasView also inherits from UIScrollView, which suggests that it was not intended for this. I would like the user to still have access to the toolkit that docks to the sides of the screen though..
I have never worked with Apple Pencil before but I expected there to be some sort of sample project for this exact scenario, a note editor with pencil functionality. I haven't found one though.
Sorry for not providing any code, but I guess my question boils down to: What is the 'best' way (using Apple's latest APIs) to implement this functionality?

Related

How to make Custom GIF Keyboard in ios

I have one doubt that how exactly GIF images loaded into Custom keyboard and user can send it. I am new in iOS so want some link which i can refer and will be helpful for me.
Read Apple docs for this, especially this one https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html is a good strating point
You can set any UIView as the view for the keyboard layout, so an UIImageView is suitable for your purpose. The real difficulty in custom keyboarding is the management of events. As you are new to iOS dev, I would like to encourage you to try much simpler things first.

The Correct Way to do Custom Keyboards in iOS?

I am looking to implement a custom toolbar that sits above my keyboard for a text field with some custom values. I've found a ton of tutorials online but this question is for asking what's the best way to do this.
This tutorial here http://blog.carbonfive.com/2012/03/12/customizing-the-ios-keyboard/ provides the most common way I can see across many tutorials, with creating a new subclass of UIView and using delegates to get that information across.
That's the commonality. However, I came across this tutorial which in the view controller itself just creates the toolbar, assigns it to the textField inputAccessory and it's good to go. In fact, I tried out the code and without any effort, I have now a custom keyboard.
http://easyplace.wordpress.com/2013/03/29/adding-custom-buttons-to-ios-keyboard/
This just seems a bit too easy to me though and I'd think the proper, Apple recommended way would be to create that UIView subclass and use delegates so that the view controller with the text fields acts as that delegate.
I'm specifically targeting iOS 7 in my app.
What are people's thoughts on this? If the second easier link is supported and is likely to pass Apple's guidelines, it's a good starting point but if delegates are the way to go, I'd rather look into that from the start.
Your thoughts will be appreciated.
There is no 'Apple Approved' way to do this, and its hard to believe anything you do here would get your app rejected. The custom keyboard you reference in your post has the iOS6 look and will appear outdated in an iOS6 app. I'll mention some iOS7 suggestions shortly, but the constant danger of mimicking what the System looks like today is guaranteed to look outdated later. In Mac/Cocoa development, Apple use to say at the WWDC that if you did something custom, make it look custom, don't take a standard Apple widget and try to duplicate it. But that advice is mostly ignored.
For iOS 7, you can create buttons that appear just like the system ones do (not pressed), but of course when someone presses them, they won't act like system buttons (i.e. animate up and "balloon" out.
I'm currently using a fantastic add-on keyboard, my fork of KOKeyboard (which uses the buttons above). This is such a cool addition. While the buttons look like iPad buttons, each one has 5 keys in it. By dragging to a corner you select one of the four, and tapping in the middle gives you that key. This might be overkill for your app, but it really helped me with mine. It looks like this:
(the Key / Value is in the under laying view.) The center control lets you move the cursor - its like a joy stick - and can be used to both move and select text. Amazing class, I wish I'd invented it!
Also, for any solution, you want to use a UIToolbar as the view holding the keys, for the reason that it supports blur of the view it overlays, just like the keyboard does. You can use the UIToolbar with no bar button items in it (if you want), and just add subviews. This is a "trick" I learned here, as there is no other way to get blur!
David's KOKeyboard (er…, the one he used - see David's comment below) looks nice. I suspect that he is using the official Apple mechanism:
inputAccessoryView
Typically, you'd set that value on a UITextView, but it can be any class that allows itself to become the first responder.
The provided view will be placed above the default apple keyboard.
It is correct that there is no official mechanism (and it is suggested against) to modify any system provided keyboard. You can add to it, as above. You can also entirely replace it for with your own mechanism. Apply will forgo the keyboard setting on your view and use a custom input mechanism if you set
inputView
set it to any view - Apple will still manage its appearance and dismissal as it does the custom keyboards.
Edit: Of course, iOS 8.x added significant access to keyboards. (not mentioned here)

Build a "grouping" animation like Apple's iPad mail app

How can I do this "grouping" animation like Apple mail or the Gmail iPad app?
Does this need to be hard coded, and completely done with the animation framework, or does Apple expose an API for this to be done. I checked the developer docs, and I don't see anything like this. But Gmail was able to exactly replicate Apple's animation, and that's why I am curious to know if it can be done in an easier way.
I am 95% sure Apple does not have a UIStackOfPaperViewController or anything like that. You would have to code this up yourself.
Conceptually, it isn't too complicated: a background view with a texture, and each subview tilted at a random angle and a drop shadow beneath. You could do the drop shadow by drawing a gradient in a view around the "real" view. Core Animation's default behaviors would probably do the right thing, e.g. if you create the page view off screen and then set the final location, it will fly onto the stack pretty much how you would like it.
If you don't need support for releases earlier than iOS 6, there's probably good stuff in the Collection View Controller to make this easier.
Hopefully that's enough information to get you started, but your question is really broad. It's difficult to answer "How do I do X?" if you don't specify your starting point, or answer "How can I do this in an easier way?" if you don't specify what you think the hard way is first.

iOS drag and drop with combination

I'm trying to figure out if this sort of thing is possible in iOS.
I'd like to have a UI where the user can drag "bubbles", each representing a noun, from a source pool into a destination panel. In addition, I'd like to be able to have another word pool of bubbles, each with adjective bubbles. These adjective bubbles could be dragged over noun bubbles already in the destination panel in order to modify them, making a combined bubble.
Mock-up of what I'm envisioning:
Is this possible in iOS (any versions)? Preferably using stock controls, but any way is fine. I will admit I have never worked with Objective-C or iOS dev before, but I am aiming for this sort of interface for my app, and want to see if it's at all possible.
Yes, this is certainly possible - but not something you could use 'stock' controls for. I would recommend learning about UIGestureRecognizer classes, try this tutorial for starters:
UIGestureRecognizer Tutorial in iOS 5: Pinches, Pans, and More!

Make page flip animation on iPhone (like magazine)

What would be the best approach to make one page flip like a real magazine? Like I put the finger in the corner of the screen then flip the page, as in this video.
Is it a sequence of images? All images are in one View or Imageview? Or there is another way to do it using the some stuff of the SDK? Does this effect exist, or would I have to write it?
This would fix your magazine problem... https://github.com/ole/leaves/tree/twopages
If it was me i'd try to use the API that someone has provided, save yourself some trouble:
CodeFlakes PaperTouch API
That's just a sequence of images as the backgrounds, and the "text" scales horizontally narrower.
For detail implementation you need to ask the original developer.
UIPageViewController is a new class in iOS 5 that you might be interested in if you don't have to support older iOS versions.
(before someone warns me about NDA, note that this class was announced publicly on one of wwdc keynote slides, I'm just giving a link to docs which can only be accessed by iOS Developer Program members)

Resources