小编Jos*_*osh的帖子

iOS - 无法从Parse后端流式传输视频

最近我使用mongoLab在heroku上创建了我自己的解析服务器来存储我的数据.

我的问题是我将视频保存为解析PFFile,但是在保存后我似乎无法流式传输.

这是我的确切步骤.

首先,我保存返回的视频 UIImagePicker

//Get the video URL
let videoURL = info[UIImagePickerControllerMediaURL] as? NSURL

//Create PFFile with NSData from URL
let data = NSData(contentsOfURL: videoURL!)
videoFile = PFFile(data: data!, contentType: "video/mp4")

//Save PFFile first, then save the PFUser
PFUser.currentUser()?.setObject(videoFile!, forKey: "profileVideo")
            videoFile?.saveInBackgroundWithBlock({ (succeeded, error) -> Void in
                print("saved video")
                PFUser.currentUser()?.saveInBackgroundWithBlock({ (succeeded, error) -> Void in
                    if succeeded && error == nil {
                        print("user saved")

                        //Hide progress bar 
                        UIView.animateWithDuration(0.5, animations: { () -> Void in                   
                            self.progressBar.alpha = 0 …
Run Code Online (Sandbox Code Playgroud)

video streaming ios pffile parse-server

6
推荐指数
1
解决办法
1332
查看次数

Swift 3 - 如何编写没有像新UIColors这样的初始化程序的函数?

在以前版本的swift中,你会得到像这样的白色 UIColor.whiteColor()

但是,在Swift 3中,如果没有像这样的初始化程序,你会得到白色 UIColor.white

如何在不使用初始化程序的情况下编写相同的函数UIColor.custom

extension UIColor {
    func custom() {
        return UIColor(white: 0.5, alpha: 1)
    }
}
Run Code Online (Sandbox Code Playgroud)

function swift swift3

5
推荐指数
1
解决办法
1143
查看次数

ios如何添加inputAccessoryView?

我正在尝试复制Facebook Messenger App,其中有一个UITextView连接到键盘的顶部.

由于这个应用程序的性质,我需要view连接,而不是ScrollView在键盘出现时手动上下滚动.

这可以通过使用a来实现inputAccessoryView.

我在这里阅读了文档.

文档非常简短,并说:

"此属性通常用于将附件视图附加到为UITextField和UITextView对象呈现的系统提供的键盘.

此只读属性的值为nil.如果要将自定义控件附加到系统提供的输入视图(例如系统键盘)或自定义输入视图(您在inputView属性中提供的视图),请在UIResponder子类中将此属性重新声明为read-write.

然后,您可以使用此属性来管理自定义附件视图.当接收器成为第一响应者时,响应者基础设施将附件视图附加到适当的输入视图,然后再显示它.

我试过宣布一个属性

@interface CommentViewController ()
@property (nonatomic, readwrite, retain) UIView *inputAccessoryView;
@end
Run Code Online (Sandbox Code Playgroud)

然后设置它:

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 20, 320, 100)];
    [view setBackgroundColor:[UIColor greenColor]];

    self.inputAccessoryView = view;

}
Run Code Online (Sandbox Code Playgroud)

然后我试着调用这两个:

  1. [self.tableView becomeFirstResponder];

  2. [view becomeFirstResponder];

什么都没发生.我究竟做错了什么?

*注意 - 额外信息:我使用的UITableViewController是我希望UIView附加的inputAccessoryView.一旦我得到了视图工作,那么我将添加一个UITextView和更多,但这主要是一个例子.

任何帮助是极大的赞赏!

objective-c uitableview ios inputaccessoryview

2
推荐指数
1
解决办法
1万
查看次数