Tag: xcode6

如何在Swift中创buildModel类并在另一个类中获取forms模型类的值

我如何在Swift中创build模型类。 我正在从模型类访问值获取错误。 谢谢。 在这里,我附上我的演示项目,U可以下载它

从iOS 6更新iOS 7/8中的标签栏高度 – UITabBar

我正在更新为以前的iOS(5/6)编写的应用程序。 我已经更新了标签栏的图标; 根据苹果的要求( 图标和图像尺寸 ),除iphone 6 plus以外,所有设备均为50x50p。 不幸的是,我的标签栏的高度是49像素(保持iOS6的大小),图标覆盖了整个空间。 这个标签栏(UITabBar)是在界面构build器中创build的,但我无法更改“尺寸检查器”值。 iOS 6/7 Deltas值不会做任何事情。 我已经将部署目标设置为iOS 7.1和Base SDK为8.0 我如何更改/增加标签栏的高度,就像在iOS 7/8?

inheritanceUIAlertController并遇到运行时错误

我不熟悉iOS和OSX的编程,并决定从Swift开始,使用iOS8 API作为testing应用程序,并尝试使用其他环境中使用的编程技术。 但是,我遇到了一个奇怪的情况,希望有人能够识别和帮助我。 这涉及UIAlertController子类的困难。 这是我第一次尝试: import UIKit class FubarAlertController: UIAlertController { convenience init (message:String) { self.init(title: "Alert", message: message, preferredStyle: UIAlertControllerStyle.Alert); self.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil)) } } 但是,我在Xcode中得到了以下警告,我不明白 – 在我看来,这些错误在我看来是自相矛盾的(赦免坏的双关语) use of self in delegating initializer before self.init is called Self.init is't called on all paths in delegating initialiser 所以然后我试了 class FubarAlertController: UIAlertController […]

Swift Scenekit – 居中SCNText – getBoundingBoxMin:Max问题

使用SCNText上的alignmentMode选项。 一直googling,看起来像alignmentMode和containerFrame有问题。 我find的替代schemebuild议使用get bounding box函数来查找文本大小,然后手动调整。 伟大的除了我不能得到的function工作。 当我尝试获取这两个向量时,出现错误: 'SCNVector3'不能转换为'UnsafeMutablePointer <SCNVector3>' 我在几何和节点上都得到了这个结果。 代码示例如下 func setCounterValue(counterValue:Int) { var v1 = SCNVector3(x: 0,y: 0,z: 0) var v2 = SCNVector3(x: 0,y: 0,z: 0) _counterValue = counterValue let newText = SCNText(string: String(format: "%06d", counterValue), extrusionDepth:sDepth) newText.font = UIFont (name: "Arial", size: 3) newText.firstMaterial!.diffuse.contents = UIColor.whiteColor() newText.firstMaterial!.specular.contents = UIColor.whiteColor() newText.getBoundingBoxMin(v1, max: v2) […]

屏幕的实际尺寸比我所看到的要大

我正在学习Swift和SpriteKit。 我在Xcode 6中创build了新的SpriteKit&Swift游戏项目,我编辑了GameScene.swift文件。 我没有触及其他文件。 问题:当球弹跳时,它受到上下方向的限制,但是当它向左或向右时,它不受限制并且熄灭,但是似乎左右极限在那里,但是它们不在屏幕边缘因为球会在一会之后回来。 这是我的GameScene.swift : import SpriteKit class GameScene: SKScene { override func didMoveToView(view: SKView) { self.backgroundColor = SKColor.whiteColor() self.physicsBody = SKPhysicsBody(edgeLoopFromRect: self.frame) self.physicsWorld.gravity = CGVectorMake(0, 0) let ball = SKSpriteNode(imageNamed: "ball") ball.position = CGPointMake(self.size.width/2, self.size.height/2) ball.physicsBody = SKPhysicsBody(circleOfRadius: ball.frame.size.width/2) self.addChild(ball) var myVector = CGVectorMake(20, 20) ball.physicsBody.applyImpulse(myVector) } override func update(currentTime: CFTimeInterval) { […]

iOS没有生成Xcode 6.1静态库.a

我试图使用Xcode 6.1为我的iOS设备创build一个静态库。 我selectXcode一个新的项目模板Cocoa Touch静态库,并命名为MyLib。 对于MyLib目标,我select模拟器中的iPhone 6。 项目打开后,我成功创buildMyLib。 但是,如果我查看产品文件夹,libMyLib.a是红色的,没有任何反应,如果我想用finder显示它。 在以前的Xcode版本中,它似乎工作,我怎么在一些教程中find。 我find了解决scheme:该库是在下创build的 ../Xcode/Products/Debug-iphonesimulator/libMyLib.a 如果我将目标切换到我的真实iPhone 6,它也可以工作,在产品文件夹中,libMyLib将变成黑色,并且库被创build ../Xcode/Products/Debug-iphoneos/libMyLib.a

将PageCurl转换为使用UIPageViewController进行滚动

我想在视图之间改变我的animation。 目前我有PageCurl,但我想有像Snapchat一样的滚动animation。 我不能使用var transitionStyle: UIPageViewControllerTransitionStyle { get } 我的ViewController: import UIKit class ViewController: UIPageViewController, UIPageViewControllerDataSource{ let pageViewController = UIPageViewController(transitionStyle: .Scroll, navigationOrientation: .Horizontal, options: nil) var messagesViewController : MessagesViewController! var searchViewController : SearchViewController! var friendsViewController : FriendsViewController! override func viewDidLoad() { super.viewDidLoad() // set UIPageViewControllerDataSource self.dataSource = self // Reference all of the view controllers on […]

升级Xcode6后,当我尝试在iPhone模拟器中进行debugging时,Xcode有时会崩溃

我正在开发一个iPhone应用程序,并在大多数时间使用iPhone模拟器。 当我尝试在iPhone Simulator中debugging我的一个项目(无论什么types和操作系统版本)以进行debugging时,Xcode有时会突然崩溃。 发生这个错误后,改变代码只是一行,重新编译解决崩溃,但是当我尝试在iPhone模拟器中debugging项目时,如果我不重新编译项目Xcode6总是崩溃。 然后,继续编程一段时间,同样的崩溃发生。 我可能会从另一个话题中发现崩溃的原因,即签名date和最后修改date的不同,但我不知道如何解决这个问题。 (这个人是因为Xcode5而说的,但是当我在Mavericks上使用Xcode5的时候,从来没有发生过这样的事情)。 在Xcode for Mac中编译并链接Python的C扩展 该项目的工作区已经嵌套了几个静态库项目,所以我怀疑这是因为编辑嵌套的库代码,但也只是在编辑主程序代码时发生。 这个崩溃并不总是发生,所以很难解决我的错误。 该项目的工作空间是巨大的,所以我想避免创build新的工作空间,如果可能的话。 我非常感谢有人帮助。 这是崩溃报告。 Crashed Thread: 25 Dispatch queue: DBGLLDBLauncher Serial Queue Exception Type: EXC_BAD_ACCESS (Code Signature Invalid) Exception Codes: 0x0000000000000032, 0x00000001359eb000 kernel messages: -2 sec CODE SIGNING: cs_invalid_page(0x1359eb000): p=21345[Xcode] final status 0x1000200, denying page sending SIGKILL -2 sec CODE SIGNING: process 21345[Xcode]: rejecting […]

无法在模拟器中运行应用程序:Xcode 6.0.1 iOS 8

我在OS X 10.9.5的早上从App Store更新通知更新了我的Xcode到6.0.1,然后重新启动了我的Mac。 然后我发现Xcode已经更新到6.0.1,但是当我试图运行我的应用程序,我只得到iOS设备作为设备,而不是模拟器。 在我的模拟器菜单pipe理设备没有模拟器只有我的Mac是存在的,然后我试图添加模拟器,但它给了我错误的path没有find,我尝试了每个解决scheme中find像search位置选项卡命令行工具,一切安好, 但是,我仍然没有得到模拟器?有人可以帮我吗?

XCode 6 UICollectionview viewwithtag不起作用

似乎XCode 6是不同的使用viewwithtags然后XCode 5是。 我在故事板中使用XCode 6中的以下代码。 50个单元格被创build,但标签是不可见的。一切正如像标签设置等。如果我使用“旧”XCode 5的方式来做与寄存器单元格分类似乎适用于iOS 7,但在iOS 8的数据没有传递给标签,直到我开始滚动。 static NSString * const reuseIdentifier = @"MyCell"; – (void)viewDidLoad { [super viewDidLoad]; // Register cell classes [self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:reuseIdentifier]; } – (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } – (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return 50; } – (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell *cell = […]