Tag: xcode

如何设置cornerRadius仅UIView的左下angular,右下angular和左上angular?

有没有一种方法来设置cornerRadius仅UIView的左下angular,右下angular和左上angular? 我尝试了以下,但最终导致视图消失。 下面的代码有什么问题吗? UIBezierPath *maskPath; maskPath = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:(UIRectCornerBottomLeft | UIRectCornerBottomRight) cornerRadii:CGSizeMake(20.0, 20.0)]; CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; maskLayer.path = maskPath.CGPath; view.layer.mask = maskLayer;

在prepareForSegue中意外地发现无IBOutlet

我有一个详细的视图控制器,我想将标签文本设置为使用indexPath行从数组中取得的值。 override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if(segue.identifier == "showView"){ let detailVC: DetailViewController = segue.destinationViewController as! DetailViewController let indexPath = self.MainTableView.indexPathForSelectedRow! detailVC.label.text = "Test" self.MainTableView.deselectRowAtIndexPath(indexPath, animated: true) } } 我不断得到一个致命的错误:意外地发现零,而解包一个可选的值。 我曾尝试切换detailVC.label.text = "Test" detailVC.label.text = names[indexPath.row]但我不断收到相同的错误,每次。 我使用相同的代码行来更改单元格的标签文本,没有任何错误,但是对于这个空白视图中间的标签,我似乎无法得到正确的结果? 有什么需要改变的想法? 顺便说一下,详细视图控制器中的@IBOutlet weak var label: UILabel!是@IBOutlet weak var label: UILabel!

我如何在IBAction(button)中放置一个void(shake手势)?

我正在创build一个应用程序,我遇到了一个问题。 我的应用程序有一个播放button,一旦用户按下animation播放和完成。 我已经创build了上面的代码,我将在下面显示,但我需要一些帮助。 当玩家按下游戏时,应该显示一个标签,说明摇动开始,当用户晃动iPhone时,标签将消失,animation将开始。 我无法将animation代码放入IBAction代码中。 请帮忙 :) -(IBAction)startanimation { animation.animationImages= [NSArray arrayWithObjects: [UIImage imageNamed:@"Frame0.png"], [UIImage imageNamed:@"Frame1.png"], [UIImage imageNamed:@"Frame2.png"], [UIImage imageNamed:@"Frame3.png"], [UIImage imageNamed:@"Frame4.png"], [UIImage imageNamed:@"Frame5.png"], [UIImage imageNamed:@"Frame6.png"], [UIImage imageNamed:@"Frame7.png"], [UIImage imageNamed:@"Frame8.png"], [UIImage imageNamed:@"Frame9.png"], [UIImage imageNamed:@"Frame10.png"], [UIImage imageNamed:@"Frame11.png"], [UIImage imageNamed:@"Frame12.png"], [UIImage imageNamed:@"Frame13.png"], [UIImage imageNamed:@"Frame14.png"], nil]; [animation setAnimationRepeatCount:1]; animation.animationDuration = 1; [animation startAnimating]; button.hidden = 1; animation.hidden = […]

Iphone:滚动时,UITableview中的复选标记会混淆

我有一个问题,我的复选标记,我适用于我的行在我的UITableView得到所有混淆,当我滚动。 我敢肯定,这与iPhone如何重用单元格有关,当我滚动离开,有一个复选标记,它可能会把它放回当我有机会。 有人能给我一些提示,告诉我如何避免这种情况,或者可能看看我的方法,看看是否有什么关系? 我在想,也许我可以保存用户所做的每一行select,然后检查显示哪些行,以确保正确的行得到复选标记,但我不能看到这样做的方式。 非常感谢。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; CustomCell *cell = (CustomCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[CustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; [cell setAccessoryView:nil]; } NSMutableArray *temp = [[NSMutableArray alloc]init]; for (int j = 0; j < [listOfRowersAtPractice count]; j++) { if ([[differentTeams […]

在swift3中的XMLParser.sharedParser.decode()

我在swift2中使用了这个代码XMLParser.sharedParser.decode() 。 但我迁移swift3这个代码没有工作。 我的代码在这里, func xmppStream(_ sender: XMPPStream!, didReceive message: XMPPMessage!) { let result1 = XMLParser.sharedParser.decode(String(message)) for (key, value) in result1 { let title = result1["title"] } if message.isChatMessage(){ sms = String(message.body()) if( sms == "" || message.body() == nil){ }else{ self.prefs.set(sms, forKey: "SMS") } } }

无法在iTunes Store中存档

当试图上传我的应用程序,我得到的错误:“你必须提供一个CFBundleIdentifier这个请求”。 info.plist,“General Identity”,iTunesConnect和App ID(Apple Developer)中的标识符(UTI格式)都是相似的。 在applicationdidFinishLaunchingWithOptions中获取CFBundleIdentifier时:我得到相同的结果。 我已经改变了项目名称,也许它有什么关系呢? 有什么build议么? 谢谢! 的Info.plist

从Xcode在iPhone4上运行应用程序失败

从Xcode在iPhone上运行我的应用程序时遇到问题。 该应用程序运行(似乎)罚款在模拟器(iPhone,iPad等)。 它也运行良好加载在iPhone4或iPad2,它只是当试图从Xcode(版本4.5),我从Xcode得到以下消息启动应用程序:无法启动“”未能获得任务进程1024“,而Xcode输出窗口中唯一的消息是: error: failed to launch '/private/var/mobile/Applications/36159066-FEDB-4A26-A05D-E599F397074A/MetriScan.app' — failed to get the task for process 1024` iPhone上没有崩溃日志,但是控制台日志包含以下内容(在运行之前清除): Oct 29 11:14:37 Bjarne mobile_house_arrest[1015] <Error>: Max open files: 125 Oct 29 11:14:38 Bjarne installd[31] <Error>: 0x2fe93000 handle_install: Install of "/var/mobile/Media/PublicStaging/MetriScan.app" requested by mobile_installation_proxy Oct 29 11:14:38 Bjarne installd[31] <Error>: 0x2fe93000 MobileInstallationInstall_Server: Installing app Bjarne.Christensen.MetriScan Oct 29 […]

将parameter passing给Swift中由NSTimer调用的方法

我试图将一个parameter passing给由我的代码中的NSTimer调用的方法。 这是抛出一个例外。 这就是我正在做的。 Circle是我的自定义类。 var circle = Circle() var timer = NSTimer.scheduledTimerWithInterval(1.0, target: self, selector: animate, userInfo: circle, repeats: true) 以下是正在调用的方法 func animate(circle: Circle) -> Void{ //do stuff with circle } 注意:该方法与被调用的类在同一个类中。 所以我相信我已经正确设定了目标。

iOS应用兼容性问题

我正在用Swift 2.1,Xcode 7.1.1做一个应用程序。 我希望它至less与iPhone 4S和5C兼容。 我configuration了我的项目设置与armv7架构,info.plist,但是当我发布我的版本,我只有在iTunes连接定义的arm64。 我需要在哪里正确configuration?

Pod安装错误的命令

我一直在尝试使用cocoapods并将它们安装到我的项目,但它试图将其安装在项目位置时给我这个错误。 它有点混乱? /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.37.2/lib/cocoapods/command.rb:127: warning: Insecure world writable dir /usr/local in PATH, mode 040777 /Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.37.2/lib/cocoapods-core/standard_error.rb:88:in `message': incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError) from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:367:in `handle_exception' from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:315:in `rescue in run' from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:303:in `run' from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.37.2/lib/cocoapods/command.rb:46:in `run' from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.37.2/bin/pod:44:in `<top (required)>' from /usr/bin/pod:23:in `load' from /usr/bin/pod:23:in `<main>'