The Apple WWDC2014 conference unveiled a number of exciting updates on iOS8, including Iclouddrive, Osxyosemite and iOS8 collaboration, ibook sharing mechanism, Quick type predictive input, swift programming language, IOS8 upward compatibility and so on, this article focuses on the new feature API for developers to introduce.
- Now, developers can use Apple's official method to achieve a real-time "frosted glass" effect (Uivisualeffect Class Reference). Before that, although many apps used the "frosted glass" effect, they were not implemented by Apple's official approach. If you want to achieve the "frosted glass" effect on IOS, you can only use two kinds of very painful methods (1. Using image processing library like gpuimage to screen, Gaussian blur, adjust brightness, saturation; 2. Set the view background to be transparent and place a uitoolbar underneath the view)
- OS X and IOS linkage (handoff) API is open (, QQ, Word and other applications can also get similar information applications in the system, Pages and other functions linked to the MAC)
- Universal App, IPhone, IPAD interface can be stored in a StoryBoard file (this is the rhythm to prepare for the big screen iphone?). )。
- The navigation bar (Uinavigationbar) is now available for gesture compression (like Safari, swipe up to compress the navigation bar and swipe down to expand the navigation bar). Doing reading applications can reduce a lot of work.
- The original warning dialog (Uialertview) and action list (Uiactionsheet) are merged into a uialertcontroller and can be added to a text box (Uitextfield).
- Separate views (Uisplitviewcontroller, similar to the settings App in ipad, left and right) now support IPhone (formerly available on ipad only)
- This time iOS supports full midi, can load the Sf2/dls format of the sound library, with midisynth support, with full MIDI cc control, support sysex information. There are classes that specialize in playing MIDI: Avmidiplayer. For audio processing, reverb, filtering, resampling, pitch modulation, high-quality 3D sound (such as HRTF), etc. are added.
In addition, the newly added Extensions feature only supports:
- Share (such as after installation, other apps do not have to set up, through a unified system interface, you can share content to the Friends circle)
- Action (it should be possible to put the custom action (uiactivity) and copy, print, add to the reading list together in Uiactivityview, at the whole system level)
- Today (should be the widget in the Notification center)
- Photo Editing (such as providing third-party filters, etc.)
- Store files (for example, PDFs in Adobe Reader can be opened with iBooks)
- Custom keyboards (third-party input methods, etc.)
First, Swift
http://practicalswift.com/2014/06/14/the-swift-standard-library-list-of-built-in-functions/
Ii. The Gospel of Web developers
As a web front-end worker, take a look at the new WebKit, from which Apple developers can better develop iphone apps with Html+js.
No longer use UIWebView, and do not use Interface Builder,wkwebview directly as views view
First, create a single View application software. Then join Webkit.framework (Build phases->link Binary with Libraries).
In your Viewcontroller, you can start using Wkwebview. In the Loadview function, the view is set to Wkwebview, in the Viewdidload () can be directly connected to the site (the practice and UIWebView).
Import Uikitimport WebKit class Viewcontroller:uiviewcontroller { var webview:wkwebview? = Wkwebview () override func Loadview () { super.loadview () = webView } override func Viewdidload () { super.viewdidload () WebView!. Loadrequest (Nsurlrequest (Url:nsurl (string"http://www.apple.com" ))) }}
Three, the improvement of the Sprite kit frame
On the WWDC2014, the Sprite kit has a lot of new improvements! One of the very interesting things is physics field! That's the physics field! This means that our game of writing virtual physics on the Sprite kit will become very simple!
In the Viewdidload function to do some initialization of Skview, add Skscene from Gamescene.sks file read Presentscene to a Skview
Override func viewdidload () { super.viewdidload () if let scene = Skscene.unarchivefromfile (" gamescene"as?" Skscene {
//Configure the view.Let Skview = Self.view asSkview Skview.showsfps=trueSkview.showsnodecount=true /*Sprite Kit applies additional optimizations to improve rendering performance*/Skview.ignoressiblingorder=true /*Set The scale mode to the fit the window*/Scene.scalemode= . Aspectfill skview.presentscene (Scene)}}
Creates a new class that inherits Skscene and overloads its methods
classSkscene:skeffectnode {init (size:cgsize)classFunc scenewithsize (size:cgsize), self!var size:cgsize var scalemode:skscenescalemode var backgroundcolor:uicolor!varDelegate: skscenedelegate!var anchorpoint:cgpoint var physicsworld:skphysicsworld! {Get} func Convertpointfromview (point:cgpoint)-cgpoint func convertpointtoview (point:cgpoint)-cgpoint var view:skview! {Get} func Update (Currenttime:nstimeinterval) func didevaluateactions () func didsimulatephysics () Func didapplyconstriants () func didfinishupdate () func Didmovetoview (View:skview!)//functions are executed immediately after the scene is present to Skview, and we can do some initialization of the scene herefunc Willmovefromview (View:skview!) func didchangesize (oldsize:cgsize)}
Rewrite the Touchesbegan:withevent function, that is, click on the screen to start the skaction sequence to play the animation mimic the ground movement effect.
Skaction provides us with a animatewithtextures function that allows us to easily implement a motion animation of a sprite.
Override Event : Uievent) {
Let Movegroundsprite = Skaction.movebyx (-groundtexture.size (). Width * 2.0, y:0, Duration:nstimeinterval (0.02 * groundTe Xture.size (). Width * 2.0))
Let Resetgroundsprite = Skaction.movebyx (Groundtexture.size (). Width * 2.0, y:0, duration:0.0)
Let Movegroundspritesforever = Skaction.repeatactionforever (Skaction.sequence ([Movegroundsprite,resetgroundsprite ]))
}
You can add texture to the sprite directly using the picture name, or you can create a sktexture, and then add the created texture to the sprite. The difference is whether the rendered picture was before or at the time the Skspritenode was created.
Sktexture class, is also a very important class, we use it to create the texture required for the sprite, can be created directly with the image name texture, the creation of the texture can be reused, The animation of the sprite can be implemented through a series of texture switch, here again to emphasize the preload, which has a great effect on the efficiency of the whole program, as a developer, we must know what kind of sprite we need to use, Before we can finish the rendering of these images, we can use them directly when we need them, which can save us some time and make the program smoother. Texture that are no longer used will be freed by memory.
Also, when we have a lot of texture, we can stitch all the texture into a texture atlas,cocos2d, use texturepacker to make Atlas, and generate plist files in the sprite The kit can also be used to automatically render all the texture in Atlas based on the Atlas image and Plist file, and then we can use the texture in accordance with the corresponding name, which also plays a significant role in memory optimization.
The physics field of the Sprite Kit Physics field has 10 altogether:
0.0,-5.0= self
Setting the bit dynamic to true means that the physics engine will no longer control the movement of this monster, and write the relevant motion code by ourselves. Set Categorybitmask to the previously defined monstercategory. Contacttestbitmask indicates that the contact agent should be notified when a collision occurs with any type of object. Collisionbitmask represents a collision event that the physical engine needs to handle.
pipeup.physicsbody =false== birdcategory
PipeUp.physicsBody.collisionBitMask = Worldcategory | Pipecategory