以上就是给各位分享ios–标签栏和导航控制器应用程序中的状态恢复,其中也会对app导航栏和标签栏的区别进行解释,同时本文还将给你拓展AddingOpenSource3DPhysicstoYouriOS
以上就是给各位分享ios – 标签栏和导航控制器应用程序中的状态恢复,其中也会对app导航栏和标签栏的区别进行解释,同时本文还将给你拓展Adding Open Source 3D Physics to Your iOS Applications (3)Using Bullet in Your iOS Application、Apple 不再在 iOS 16.2 发布之前签署 iOS 16.1 和 iOS 16.1.1、C++ write and read file via fstream in ios::out,ios::in,ios::app mode、iOS 15.6.1 验证通道已关闭,iOS 16还能降级吗?等相关知识,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录一览:- ios – 标签栏和导航控制器应用程序中的状态恢复(app导航栏和标签栏的区别)
- Adding Open Source 3D Physics to Your iOS Applications (3)Using Bullet in Your iOS Application
- Apple 不再在 iOS 16.2 发布之前签署 iOS 16.1 和 iOS 16.1.1
- C++ write and read file via fstream in ios::out,ios::in,ios::app mode
- iOS 15.6.1 验证通道已关闭,iOS 16还能降级吗?
ios – 标签栏和导航控制器应用程序中的状态恢复(app导航栏和标签栏的区别)
问题:重新启动时,所选选项卡似乎按预期还原,但所述选项卡内的导航层次结构不是.
发展:
>我首先开始使用项目模板“基于标签的应用程序”.
>接下来,我将恢复ID添加到子视图控制器和标签栏控制器.
>在app委托中,我实现了应用程序(_:shouldSaveApplicationState :)和应用程序(_:shouldRestoreApplicationState :).
然后我运行应用程序,切换到第二个(右)选项卡,点击主页,终止. o重新启动,显示右侧选项卡(如预期).到现在为止还挺好.
>接下来,我转到故事板并将两个子视图控制器嵌入相应的导航控制器中,并为这些控制器分配恢复ID.
我运行应用程序,恢复仍然有效.还好.
>接下来,我添加一个“细节”视图控制器;它的类是故事板的UIViewController的自定义子类,具有配置调试标签内容及其视图背景颜色的属性.
>我在每个选项卡的顶视图控制器上放置了一个“显示详细信息…”按钮,并从每个选项卡创建一个segue到(共享)详细视图控制器中.所以现在我的故事板看起来像一个六边形(同样,两个segues都有在Interface Builder中设置的标识符).因此,左右顶视图控制器共享相同类型的“细节”视图控制器.在展示中,它被配置为区别于它被推动的位置(参见下一点).
>在每个顶视图控制器的prepareForSegue(_:sender :)方法中,我以不同的方式配置推送的详细信息视图控制器:不同的文本和背景颜色(分别为“左”和“蓝”,“右”和红色).
>我向详细视图控制器添加了代码,以保存和恢复文本和背景颜色属性的状态:encodeRestorableStateWithCoder(_ :)和decodeRestorableStateWithCoder(_ :).此外,我实现了viewDidLoad(),以便在视图中反映这些属性的值.每当它被实例化并通过segue推入导航时,首先设置属性然后用于在viewDidLoad()中配置视图.每当在恢复期间实例化时,属性都在decodeRestorableStateWithCoder(_ :)中设置,并且类似地在viewDidLoad()中使用.
…但是当我运行此代码时,最后选择的选项卡将被恢复,但仅限于顶视图控制器 – 左侧或右侧 – 而不是详细信息.有趣的是,最后设置到细节视图控制器的背景颜色瞬间闪烁.
我在encodeRestorableStateWithCoder(_ :)和decodeRestorableStateWithCoder(_ :)中放置了断点,但只执行了第一个(编码).
>想知道可能缺少什么,我继续实施app delegate的应用程序(_:viewControllerWithRestorationIdentifierPath:coder:)(总是返回nil,但是记录传递的路径组件).
关于是否需要此方法的文档不是很清楚,并且在任何情况下,除了细节之外的所有视图控制器似乎都可以完美地恢复,即使没有它.我添加了代码,根据最后一个路径组件(即该控制器的恢复ID)实例化每个视图控制器并返回它.
现在,调用decodeRestorableStateWithCoder(_ :),但导航仍然会在瞬间返回到选项卡的顶视图控制器.
那么发生了什么?在标签栏导航控制器应用程序中实现状态保存和恢复我缺少什么?
解决方法
>事实证明,在我的情况下,我不需要实现应用程序(_:viewControllerWithRestorationIdentifierPath:coder :). (见comments of this answer)
>我的encodeRestorableStateWithCoder(_ :)和decodeRestorableStateWithCoder(_ :)的实现
没有打电话给超级(如上面问题的accepted answer所示).
>最后,我得到了正确的视图控制器(细节),但其子视图的状态(文本标签内容和主视图背景颜色)处于初始的空状态(未恢复到其上一个状态-ie,文本标签)内容和bg颜色).正如在this question中提到的,viewDidLoad()在decodeRestorableStateWithCoder(_ :)之后没有被调用(就像我假设的那样),所以我从viewDidLoad()和decodeRestorableStateWithCoder(_ :)中调用一个公共方法来更新UI.
像往常一样,在搜索或尝试对我的代码进行足够的修改之前,我急忙发布一个问题(道歉……).
我希望这至少可以帮助别人.
像往常一样,我会等几天才接受我自己的答案,以防万一有人掏出更多的光.
Adding Open Source 3D Physics to Your iOS Applications (3)Using Bullet in Your iOS Application
Using Bullet in Your iOS Application
All that remains is to build an application that actually uses Bullet and displays 3D objects. Apple's GLKit framework makes it relatively easy.
Make the view controller class generated by Xcode's Single View Application template into a subclass of GLKViewController instead of UIViewCintroller. The PViewController.h file in the tutorial sample code contains the following lines:
#import <GLKit/GLKit.h> PViewController : @interfaceGLKViewController
Next,edit the MainStoryboard.storyboard file generated by Xcode's Single View Application template. Set the class of the generated view to GLKView using Xcode's Identity inspector,shown in figure 12.
Figure 12 Setting the view's class to GLKView
Add the GLKit and OpenGLES frameworks to the project. The easiest way is to edit the project's Build Phases,as shown in figure 13. Press the + button in the Link Binary with Libraries section to add frameworks.
Figure 13 GLKit and OpenGLES frameworks added to the project
If you build and run the tutorial project Now,you should see a black screen. The next step is to create a physics simulation and draw something more interesting.
The tutorial source code includes a file named PAppDelegate.mm. The .mm extension tells Xcode to compile the file as Objective-C++ code intermixing C++ and Objective-C. The following code declares instance variables to store Bullet physics objects:
#import "PAppDelegate.h" #include "btBulletDynamicsCommon.h" #include <map> < *,*> GModelShapeMap; () { *collisionConfiguration; *dispatcher; *overlappingPairCache; *solver; *dynamicsWorld; *> collisionShapes; modelShapeMap; } @endtypedefstd::mapPPhysicsObjectbtCollisionObject@interfacePAppDelegatebtDefaultCollisionConfigurationbtCollisiondispatcherbtbroadphaseInterfacebtSequentialImpulseConstraintSolverbtdiscreteDynamicsWorldbtAlignedobjectArray<btCollisionShapeGModelShapeMap
The GModelShapeMap modelShapeMap variable is used to store the relationships between Objective-C objects representing Boxes and spheres and the corresponding shapes simulated by Bullet. A C++ map is a standard class similar in function to Cocoa Touch'sNSDictionary class.
The physics simulation is initialized in PAppDelegate's -application:didFinishLaunchingWithOptions: method that's part of the Cocoa Touch standard application delegate protocol. The simulation is configured to use Earth's gravitational acceleration of -9.81 meters per second2. Comments explain the steps needed to initialize Bullet. Don't worry if it doesn't make much sense to you. It's boilerplate code.
///////////////////////////////////////////////////////////////// // Creates needed physics simulation objects and configures // properties such as the acceleration of gravity that seldom // if ever change while the application executes. - ()application:( *)application didFinishLaunchingWithOptions:( *)launchOptions { ///collision configuration contains default setup for memory,// collision setup. Advanced users can create their own // configuration. = (); ///use the default collision dispatcher. For parallel // processing you can use a diffent dispatcher // (see Extras/BulletMultiThreaded) = (); ///btDbvtbroadphase is a good general purpose broadphase. You // can also try out btAxis3Sweep. = (); ///the default constraint solver. For parallel processing you // can use a different solver (see Extras/BulletMultiThreaded) = ; = (,); ->setGravity(()); return YES; }BOOLUIApplicationNSDictionarycollisionConfigurationnewbtDefaultCollisionConfigurationdispatchernewbtCollisiondispatchercollisionConfigurationoverlappingPairCachenewbtDbvtbroadphasesolvernewbtSequentialImpulseConstraintSolverdynamicsWorldnewbtdiscreteDynamicsWorlddispatcheroverlappingPairCachesolvercollisionConfigurationdynamicsWorldbtVector30,-9.81,0
PAppDelegate's -applicationWillTerminate: method tears down the simulation built in -application:didFinishLaunchingWithOptions:. It's not necessary to implement -applicationWillTerminate: in the tutorial sample code because when the application terminates,iOS will automatically reclaim the memory and other resources consumed by the physics engine. The code is provided in PAppDelegate.mm as example to follow if you ever need to clean up the physics engine while the application continues to execute.
PAppDelegate provides the following -physicsUpdateWithelapsedtime: method. Call the method periodically to give the physics engine opportunities to recalculate object positions and orientations.
///////////////////////////////////////////////////////////////// // Turn the crank on the physics simulation to calculate // positions and orientations of collision shapes if // necessary. The simulation performs up to 32 interpolation // steps depending on the amount of elapsed time,and each step // represents 1/120 seconds of elapsed time. - ()physicsUpdateWithelapsedtime:()seconds; { dynamicsWorld->stepSimulation(seconds,/); }voidNSTimeInterval321120.0f
That's all it takes to start using Bullet physics for iOS. The simulation doesn't produce any interesting results unless some objects are added and set in motion to collide with each other. It's time to create,register,and draw physics objects.
GLKit provides most of the features needed. The tutorial project includes files named sphere.h and cube.h containing data declarations for 3D shapes. The data consists of vertex positions and "normal" vectors. Each shape is drawn as a list of connected triangles. The normal vectors provide information used to calculate how much simulated light reflects from each triangle.
The PViewController class implements all of the drawing for the tutorial. The drawing code is suboptimal to keep the code simple,and it turns out not to matter at run time. Profiling the tutorial code reveals that less than 20% of the application's execution time is spent drawing. Even if the drawing code is removed entirely,the application only runs 20% faster.
PViewController declares the following properties. The baseEffect property stores an instance of GLKit's GLKBaseEffect class. Modern GPUs are programmable allowing almost unlimited flexibility when rendering 3D graphics. The programs running on the GPU are sometimes called effects. GLKBaseEffect encapsulates the GPU programs needed by simple applications so that you don't need to dive into GPU programming when getting started.
@interface () @property (strong,nonatomic,readwrite) *baseEffect; @property (strong,readwrite) *BoxPhysicsObjects; @property (strong,readwrite) *spherePhysicsObjects; @property (strong,readwrite) *immovableBoxPhysicsObjects; @endPViewControllerGLKBaseEffectNSMutableArrayNSMutableArrayNSMutableArray
Other than baseEffect,the other properties all store arrays of Objective-C objects representing spheres and Boxes in the simulation. Bullet only recalculates positions for physics objects that have mass. Objects created with zero mass are therefore immovable within the simulation. They don't become displaced when other objects collide or fall in response to gravity. The immovableBoxPhysicsObjects property stores an array of zero mass Boxes used to form a floor. Without a few immovable objects in the simulation,all of the other objects would quickly fall out of view as the result of simulated gravity.
Two GLKViewController methods provide the key to drawing with GLKit: -update and -glkView:drawInRect:. The –update method is called periodically in sync with the iOS device display refresh rate. The display always refreshes 60 times per second,butGLKViewController's default behavior is to call –update at 30Hz. In other words, –update is called once for every two display refreshes. GLKViewController can be configured to call –update at other rates,but 30 times per second works well for simulations. Right after calling –update, GLKViewController tells the view it controls to display,and the view calls back to GLKViewController's -glkView:drawInRect:. Therefore,you implement simulation update in –update and implement custom 3D drawing code in -glkView:drawInRect:.
///////////////////////////////////////////////////////////////// // This method is called automatically at the update rate of the // receiver (default 30 Hz). This method is implemented to // update the physics simulation and remove any simulated objects // that have fallen out of view. - ()update { *appDelegate = [[] ]; [appDelegate : .]; // Remove objects that have fallen out of view from the // physics simulation [ ]; }voidPAppDelegateUIApplication sharedApplicationdelegatephysicsUpdateWithelapsedtimeselftimeSinceLastUpdateselfremoveOutOfViewObjects
The following drawing code sets baseEffect properties to match the orientation of the iOS device,specifies perspective,positions a light,and prepares for drawing 3D objects. Theaspect ratio is the ratio of a view's width to its height. The aspect ratio may change when an iOS device is rotated from portrait orientation to landscape and back. Perspectivedefines how much of the 3D scene is visible at once and how objects in the distance appear smaller than objects up close.
In the real world,we only see objects that reflect light into our eyes. We perceive the shape of objects because different amounts of light reflect for different parts of the objects. Setting the baseEffect's light position controls how OpenGL calculates the amount of simulated light reflected off each part of a virtual 3D object. Calling [self.baseEffect preparetoDraw] tells the base effect to prepare a suitable GPU program for execution.
///////////////////////////////////////////////////////////////// // GLKView delegate method: Called by the view controller's view // whenever Cocoa Touch asks the view controller's view to // draw itself. (In this case,render into a frame buffer that // shares memory with a Core Animation Layer) - ()glkView:( *)view drawInRect:()rect { // Calculate the aspect ratio for the scene and setup a // perspective projection aspectRatio = ()view. / ()view.; // Set the projection to match the aspect ratio .. = ( (),// Standard field of view aspectRatio,// Don't make near plane too close ); // Far arbitrarily far enough to contain scene // Configure a light ... = (,);// Directional light [. ]; // Clear Frame Buffer (erase prevIoUs drawing) (|); [ ]; [ ]; }voidGLKViewCGRectconstGLfloatGLfloatdrawableWidthGLfloatdrawableHeightselfbaseEffecttransform.projectionMatrixGLKMatrix4MakePerspectiveGLKMathdegreesToradians35.0f0.2f200.0fselfbaseEffectlight0positionGLKVector4Make0.6f1.0f0.4f0.0fselfbaseEffectpreparetoDrawglClearGL_COLOR_BUFFER_BITGL_DEPTH_BUFFER_BITselfdrawPhysicssphereObjectsselfdrawPhysicsBoxObjects
OpenGL ES is a technology for controlling GPUs. Parts of OpenGL ES execute on the GPU itself,and other parts execute on the cpu. Programs call a library of C functions provided by OpenGL to tell OpenGL what to do. The glClear() function,called in the tutorial's -glkView:drawInRect:, erases prevIoUs drawing and discards prevIoUsly calculated information about which 3D objects are in front of others.
PViewController's –drawPhysicssphereObjects and –drawPhysicsBoxObjects methods draw spheres and Boxes with positions and orientations calculated by the physics engine. Without going into a lot of detail,each of the methods calls OpenGL ES functions to specify where to find vertex data defining triangles. Then the triangles are drawn by calling code similar to the following:
// Draw triangles using the first three vertices in the // currently bound vertex buffer (,// Start with first vertex in currently bound buffer sphereNumVerts);glDrawArraysGL_TRIANGLES0
OpenGL ES can only draw points,lines segments,and triangles. Complex shapes are composed of many triangles. The shapes in this tutorial are defined in sphere.h and cube.h. The shapes were initially drawn in a free open source 3D modeling application called Blender. Modeling is the term used by artists who create 3D shapes. The created models are exported from Blender in .obj file format and then converted into C header files suitable for direct use with OpenGL. Conversion is performed by an open source Perl language script.
It takes a little more work to setup GLKit. PViewController's -viewDidLoad method shows representative boilerplate code. This article glosses over methods like PViewController's –addRandomPhysicsObject. The code for adding physics objects is straightforward and particular to this tutorial. You'll most likely add different objects with different logic in your physics simulation projects.
Conclusion
The simulation provides remarkably complex and varied interaction between objects. The downloadable code is available in two variants. The Physics zip file (3dphyslibios_physics.zip) contains a Physics folder with an Xcode project. If you have built the Bullet demo applications for Mac OS X,you can copy the Physics folder into your bullet-2.80-rev2531 folder,double-click the Physics.xcodeproj file and press Run. A separate larger PhysicsPlusBullet zip file (3dphyslibios_physicsplusbullet.zip) contains the tutorial example and the needed Bullet source code combined. As always with open source,it's better to get the source code directly from the maintainers instead of grabbing a snapshot preserved in a tutorial's .zip file. Nevertheless,if you're impatient,the PhysicsPlusBullet zip file will get you up and running quickly.
This article provided a whirlwind tour of two large and powerful frameworks,Bullet and GLKit. It's not difficult to combine the two technologies in iOS applications. Like many open source libraries,Bullet is relatively easy to compile for iOS in spite of quirks related to the tools and coding style used by the library's authors. GLKit enables development of interesting and visually complex 3D applications with very little code. The tutorial implements all of its drawing in about 200 lines of code including comments and blank lines.
If you are interested in a more thorough introduction to 3D graphics concepts and GLKit,my new book, Learning OpenGL ES for iOS: A Hands-on Guide to Modern 3D Graphics Programming,is complete and available Now as a Rough Cut electronic edition. Look for the title at your favorite bookstore in the fall. Free sample codefrom the book is available.
Apple 不再在 iOS 16.2 发布之前签署 iOS 16.1 和 iOS 16.1.1
继 ios 16.1.2 于 11 月 30 日发布后,apple 现已停止签署 ios 16.1 和 ios 16.1.1。
Apple 不再签署 iOS 16.1 和 iOS 16.1.1
iOS 16.1于 10 月发布,具有多项新功能和增强功能,例如 iCloud 共享照片库、适用于 iPhone 用户的 Fitness+、Live Activities 等。在11月份发布的iOS 16.1.1修复了缺陷并改进了安全性。
然后,在 11 月 30 日,Apple 发布了 iOS 16.1.2,以增强 iPhone 14 的崩溃检测功能,并提高无线运营商的兼容性。这是目前正式提供给用户的最新iOS版本。
与此同时,苹果即将在未来几天向公众发布iOS 16.2 。该更新将添加新的 Freeform 应用程序、对 Home 应用程序的改进、面向 iPhone 14 Pro 用户的新的永远在线选项、Apple Music Sing 等。
经常有越狱的iPhone和iPad用户恢复到旧版本的iOS。目前还没有任何迹象显示正在开发适用于 iOS 16 的越狱工具。将 Apple 设备恢复到以前版本的 iOS 有时也会对升级到最新版本的 iOS 后遇到重大错误的用户有所帮助。
从 iOS 16 降级到 iOS 15
即使您无法轻松恢复到iOS 16.1版本,仍有可能将您的设备降级至iOS 15版本以上。Apple正在为使用iOS 15.7.1的用户提供安全更新,导致此情况发生。如果想将 iPhone 或 iPad 降级,就必须使用 Mac 或 PC。
这不是苹果第一次提供让用户继续使用旧版 iOS 的选项。去年,一旦 iOS 15 可用, 用户可以选择在 iOS 14 上停留更长时间 ,而苹果仍在为其发布安全更新。然而, 该公司在几个月后取消了这个选项。
目前尚不清楚 iOS 15.7.1 作为 iOS 16 的替代选项将保留多长时间。
以上就是Apple 不再在 iOS 16.2 发布之前签署 iOS 16.1 和 iOS 16.1.1的详细内容,更多请关注php中文网其它相关文章!
C++ write and read file via fstream in ios::out,ios::in,ios::app mode
#include <iostream> #include <uuid/uuid.h> #include <ostream> #include <istream> #include <fstream> #include <iostream> using namespace std; void retrieveUuid(char *uuidValue); void writeFile2(); void readFile3(); int main() { writeFile2(); readFile3(); return 0; } void readFile3() { fstream wFile; wFile.open("log3.txt",ios::app|ios::in|ios::out); if(!wFile.is_open()) { cout<<"Create or open log3.txt Failed!"<<endl; } string uuidValue; int num=0; while(getline(wFile,uuidValue)) { cout<<"Id="<<++num<<",value="<<uuidValue<<endl; } wFile.close(); printf("Finished!\n"); } void writeFile2() { fstream wFile; wFile.open("log3.txt",ios::app|ios::out|ios::in); if(!wFile.is_open()) { cout<<"Create or open log3.txt Failed!"<<endl; } char *uuidValue=(char*)malloc(40); for(int i=0;i<10000;i++) { retrieveUuid(uuidValue); wFile<<uuidValue<<endl; } free(uuidValue); wFile.close(); } void retrieveUuid(char *uuidValue) { uuid_t newUUID; uuid_generate(newUUID); uuid_unparse(newUUID,uuidValue); }
Complile and run
g++ -g -std=c++2a h2.cpp -o h2 -luuid
Run the ./h2 command
./h2
iOS 15.6.1 验证通道已关闭,iOS 16还能降级吗?
苹果 于 8 月 17 日给大家发布了iOS 15.6.1正式版,修复了整体错误 Bug 并改进了性能。苹果还通过更新修复了两个主要的安全漏洞,这两个漏洞都允许应用程序在未经用户同意的情况下以内核权限执行任意代码。然而,随着 iOS 16 正式版发布,苹果现已经关闭了 iOS 15.6.1 的验证通道,用户无法再将 iPhone、iPad 和 iPod touch 软件降级到 iOS 15.6.1,这对等待越狱工具的用户有直接的影响。
iOS 16发布不久,很多老机型设备升级后效果不理想,而今iOS 15.6.1 验证通道关闭,升级iOS 16后不稳定怎么办?升级iOS 16后还能降级吗?
iOS 15.6.1正式版推送以后,苹果还给大家推送了iOS 15.7 正式版,该版本留给暂时不愿意升级 iOS 16 正式版的用户。也就是说用户若觉得iOS 16不好用,仍有办法从 iOS 16 降级到 iOS 15。
iOS 15.7 正式版修复了联系人、地图、Safari、Safari 扩展、快捷方式和 WebKit 的安全问题,还解决了多个内核漏洞。苹果表示其中一个内核漏洞已被积极利用,非常适合旧机型养老。
如何降级到iOS 15?
可直接使用爱思助手一键刷机降级到iOS 15,方法如下:
下载安装最新版爱思助手 ,用数据线把移动设备连接到电脑;点击上方“智能刷机”进入到“一键刷机”界面,在可刷版本中选择iOS 15.7,点“立即刷机”即可。
总结
以上是小编为你收集整理的iOS 15.6.1 验证通道已关闭,iOS 16还能降级吗?全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
关于ios – 标签栏和导航控制器应用程序中的状态恢复和app导航栏和标签栏的区别的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于Adding Open Source 3D Physics to Your iOS Applications (3)Using Bullet in Your iOS Application、Apple 不再在 iOS 16.2 发布之前签署 iOS 16.1 和 iOS 16.1.1、C++ write and read file via fstream in ios::out,ios::in,ios::app mode、iOS 15.6.1 验证通道已关闭,iOS 16还能降级吗?的相关信息,请在本站寻找。
本文标签: