ユーレカは異なるデータ型を含む新しいレコード(MediaPicker
)を作成するために使用されるため、viewControllerの表示方法が不思議です。ユーレカフォームの行を使用してviewControllerを表示する方法
ジョブを実行する行はどれですか? PushRow
またはButtonRow
これは私がこれを作成しようとする私のクラスです。
import UIKit
import MediaPlayer
import Eureka
public final class MusicRow<T: Equatable> : SelectorRow<T, PushSelectorCell<T>, SelectorViewController<T>>, RowType {
public required init(tag: String?) {
super.init(tag: tag)
presentationMode = .Show(controllerProvider: ControllerProvider.Callback {
return AddMusicViewController(){ _ in }
}, completionCallback: { vc in
vc.navigationController?.popViewControllerAnimated(true)
})
}
}
public class AddMusicViewController: MPMediaPickerController, MPMediaPickerControllerDelegate {
var musicPicker: MPMediaPickerController!
public var row: RowOf<MPMediaItemCollection>!
public var completionCallback : ((UIViewController) ->())?
public override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
// Setup sections/rows for tableView
addMusic()
}
// Initialize musicPicker and customize it
func addMusic() {
musicPicker = MPMediaPickerController.self(mediaTypes:.Music)
musicPicker.delegate = self
musicPicker.allowsPickingMultipleItems = true
view.addSubview(musicPicker.view)
}
// After selection, store the data into an array
public func mediaPicker(mediaPicker: MPMediaPickerController, didPickMediaItems mediaItemCollection: MPMediaItemCollection) {
musicTemp = nil
musicTemp = mediaItemCollection
if musicTemp == nil {
noMusic = true
} else {
noMusic = false
}
completionCallback?(self)
}
// Cancel mediaPickerController
public func mediaPickerDidCancel(mediaPicker: MPMediaPickerController){
// Dismiss the picker if the user canceled
noMusic = true
completionCallback?(self)
}
}
以下は、私が直面しているエラーです。
@EricAyaまあ、実際にはありません。私はiOS開発に全く新しいです。そして、ユーレカはフォームに関しては非常に良いフレームワークと思われます。だから、私は自分のアプリを使用します。しかし、カスタム実装がある場合、それを正しく関連付けることはできません。この場合、あなたは何をお勧めしますか?ありがとう.. – Shyam
私もそれをしました。私が受け取るエラーは、 '(_ _ - > _)型の引数リストを持つ' AddMusicViewController 'タイプのイニシャライザを呼び出せません。 – Shyam
こんにちはShyam、私は行の選択にGooglePlacesの自動補完ViewControllerを提示したい(https: //developers.google.com/places/ios-api/autocomplete)あなたのコードを使用することは可能ですか? – Annjawn