TableView单元格video自动播放

我所做的: 当单元格完全可见时,我添加了播放video的代码,当我向下或向上滚动时,再次重新载入tableview并再次播放video。 但是,我的要求是不同的。 我真正想要的是: 我想播放一个video,直到完全可见的向后或向前的单元格。 当用户向下滚动或向上滚动时,不会影响直到完全可见的向后或向前单元格。 devise Table Cell Layout Description -> Video Table Cell (Fix height 393) -> Content View -> Main view – (as per Content view of Table view Cell) -> Title View (0, 0, MainView.width, 57) -> Video View (0, 57, MainView.width, 200); -> Description View (0, 257, MainView.width, 136) 编码: […]

iOS中的闹钟应用程序

我必须为iPhone创build一个闹钟应用程序,用户可以在其中设置闹钟时间和声音。 在这样做的时候,我使用了UILocalNotification来发起警报。 现在,在UILocalNotification中,首先我们通过选项“Close”和“View”来获得Notification Alert。 如果用户点击“查看”,那么我的委托收到application:didReceiveLocalNotification:消息,并发出警报声音。 但在系统本地报警应用程序中,我们看不到通知警报; 它只是直接播放警报声音。 我如何让我的应用程序使用这种行为?

获取UIWebView内容的高度

我有一个使用loadHtmlString函数加载数据的uiwebview。事情是我从SQLite数据库加载数据,每当我加载不同的string不同的长度,当然networking视图获得不同的高度。 现在我需要知道每一次的uiwebview的确切的高度,以加载一个imageView下的webView。 我努力了 – (void)webViewDidFinishLoad:(UIWebView *)aWebView { CGRect frame = aWebView.frame; frame.size.height = 1; aWebView.frame = frame; CGSize fittingSize = [aWebView sizeThatFits:CGSizeZero]; frame.size = fittingSize; aWebView.frame = frame; NSLog(@"Size: %f, %f", fittingSize.width, fittingSize.height); } 但我总是得到相同的结果。 我需要知道如何dynamic获取每次加载的Web视图的高度。 谢谢

Xcode 8和iOS 10 Cordova项目上的代码签名错误

我有一个cordova项目,我build立和运行本地部署在我的iPhone和Android设备上。 但是,我升级到Xcode 8和我的iPhone iOS到iOS 10 ,我无法在本地生成ipas。 它失败,并出现以下错误。 ===使用configurationdebugging===构build目标*的项目* 检查依赖性签署“ *”需要一个开发团队。 在项目编辑器中select一个开发团队。 ** SDK'iOS 10.0'中的产品types'Application'需要代码签名 更新之前,这是完美的工作。 更新之后, iOS构build失败。 该项目的相关版本号是 ios-deploy -V – 1.8.6 xcodebuild -version – Xcode 8.0 Build version 8A218a 我有我的Xcode安装与适当的证书和供应configuration文件。

将文本文件保存到iOS 7中的文档目录

我想保存一个纯文本文件到iOS 7中的文档目录。这是我的代码: //Saving file NSFileManager *fileManager = [[NSFileManager alloc] init]; NSArray *urls = [fileManager URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask]; NSString *url = [NSString stringWithFormat:@"%@", urls[0]]; NSString *someText = @"Random Text To Be Saved"; NSString *destination = [url stringByAppendingPathComponent:@"File.txt"]; NSError *error = nil; BOOL succeeded = [someText writeToFile:destination atomically:YES encoding:NSUTF8StringEncoding error:&error]; if (succeeded) { NSLog(@"Success at: %@",destination); } else […]

Swift 2.0中使用故事板的通用控制器

我试图为我的应用程序创build一个GenericListController。 我有一个ProductListController扩展这个扩展UIViewController的通用控制器。 我已经将ProductListController连接到一个故事板并创build了2个sockets,但是我总是收到这个错误: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7c158ca0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key searchBar.' 我收到所有我的网点这个错误,如果我从GenericListController中删除genericsT它的作品。 我想故事板不能加载generics的超级。 我怎样才能使它工作? 我的代码: class GenericListController<T> : UIViewController { var list : [T] = [T]() var filteredlist : [T] = [T]() func getData(tableView : UITableView) { ….. } func setData(list […]

Xcode 4.3:在Organizer的档案中缺lessiOS应用程序的图标

由于升级到Xcode 4.3.x,我在Organizer中的iOS应用程序的档案没有图标。 (虽然我的Mac OS X应用程序上有图标) 一个特别的应用程序是一个iPad应用程序,我提供了2个图标(普通+视网膜大小),但仍然没有在我的档案中find它的图标。 xcode-select -print-path返回/Applications/Xcode.app/Contents/Developer (我相信这是正确的设置,因为我想在terminal中使用xcodebuild和xcron) 编辑: 经过调查,我发现从Xcode4.3.2开始,档案正在使用iOS5 CFBundleIcons属性中embedded的CFBundleIconFiles的第一项来显示,但是如果你的文件保留.png扩展名,它将不起作用 。 1 /关于苹果的文档说: 使用CFBundleIcons键指定图标文件时,最好省略图像文件的文件扩展名。 如果包含文件扩展名,则必须明确添加所有图像文件的名称(包括任何高分辨率的变体)。 如果省略文件扩展名,系统会自动检测文件的高分辨率变体,即使它们不包含在数组中。 鉴于你不想有文件扩展名到你的图标文件(参见上面),当你的文档实际上包含“ipad”和“ipad @ 2x”时,仅在.plist中提及“ipad”将不起作用。 我不得不在视网膜设备上实际使用的视网膜版本.plist中提及。 但是没有.png扩展名的图标在你尝试在App Store上提交时不会被validation。 我很累。 图标正在使我的生活成为现在的噩梦。 2 /关于TestFlight图标的支持: TestFlight似乎不支持没有扩展名的图标文件,因为我现在看不到我的服务图标,现在我删除了我的文件.png扩展名

UITableView使用Swift

我的TapCell1.swift 这是自定义的UITableViewCell View import UIKit class TapCell1: UITableViewCell { @IBOutlet var labelText : UILabel init(style: UITableViewCellStyle, reuseIdentifier: String!) { println("Ente") super.init(style: UITableViewCellStyle.Value1, reuseIdentifier: reuseIdentifier) } override func setSelected(selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) } } 我的ViewController.swift 它的所有数据源和委托都设置正确。但我的自定义单元格不显示。 import UIKit class NextViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet var label: UILabel @IBOutlet var tableView : […]

我怎么能让背景音乐继续播放,而我的应用程序仍然在使用Swift播放它的声音

我创build了一个应用程序,我试图让用户在玩我的游戏的同时继续听音乐,但每当他们点击“播放”,游戏就会停止播放背景音乐。 我正在使用Swift在iOS上开发。 这是一段启动游戏声音的代码。 func playSpawnedDot() { var alertSound: NSURL = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("spawnDot", ofType: "mp3")!)! var error:NSError? audioPlayer = AVAudioPlayer(contentsOfURL: alertSound, error: &error) audioPlayer.prepareToPlay() if volumeBool { audioPlayer.play() } }

iOS – 以编程方式使用自动布局将UIView放置在超级视图的中心位置

你如何以编程方式设置一个UIView使用自动布局在其超视图的中心? UIButton* viewObj = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [viewObj setTranslatesAutoresizingMaskIntoConstraints:NO]; [viewObj setBackgroundColor:[UIColor greenColor]]; [self.view addSubview:viewObj]; NSLayoutConstraint* cn = [NSLayoutConstraint constraintWithItem:viewObj attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]; [self.view addConstraint:cn]; cn = [NSLayoutConstraint constraintWithItem:viewObj attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0]; [self.view addConstraint:cn]; 上面的代码适用于我的UIButton,但我有麻烦取代第一行的东西,适用于UIView。 我试过了 UIView* viewObj = [UIView alloc] initWithFrame:CGRectZero]; 但是这个视图并没有在模拟器中显示出来。 有什么build议么? 谢谢!