cellForItemAt indexPath如果使用则不会打电话UICollectionViewDelegateFlowLayout。
在这种情况下:
class Something: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource {
}
Run Code Online (Sandbox Code Playgroud)
它叫我cellforItemAtIndexPath,但不叫我
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
}
Run Code Online (Sandbox Code Playgroud)
但如果我包括UICollectionViewDelegateFlowLayout:
class Something: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
}
Run Code Online (Sandbox Code Playgroud)
它会调用:
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
}
Run Code Online (Sandbox Code Playgroud)
但不会打电话cellForItemAtIndexPath。我不明白这个问题。这是iOS的错误,还是什么都看不到?
ios uicollectionview uicollectionviewcell uicollectionviewlayout swift
我正在尝试调用此行:
curl https://getpocket.com/v3/oauth/authorize --insecure -X POST -H "Content-Type: application/json" -H "X-Accept: application/json" -d "{\"consumer_key\":\"61999-492f79db0bd3292f0b4...1\",\"code\":\"c9166709-0c45-2b1f-a22f-e...r\"}"
Run Code Online (Sandbox Code Playgroud)
每次我得到403 Forbidden.
我不知道也不明白其中的原因。
有人知道吗?我也通过 Python 尝试过:
import requests
auth_params = {'consumer_key': 'key_here', 'redirect_uri': 'https://www.twitter.com/'}
tkn = requests.post('https://getpocket.com/v3/oauth/request', data=auth_params)
tkn.content
Run Code Online (Sandbox Code Playgroud)
上面的代码给了我一个代码:
usr_params = {'consumer_key': 'key_here', 'code': 'code_here'}
usr = requests.post('https://getpocket.com/v3/oauth/authorize', data=usr_params)
usr.content
Run Code Online (Sandbox Code Playgroud)
我403也来了。
我该如何解决?
我有一个UITabBarController,所有其他视图控制器都连接到它.现在我想将我的控制器显示为:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc: ViewController = storyboard.instantiateViewControllerWithIdentifier("ViewController") as! ViewController
Run Code Online (Sandbox Code Playgroud)
但是当我试图:
let rootViewController = self.window?.rootViewController as! UINavigationController
rootViewController.pushViewController(vc, animated: true)
Run Code Online (Sandbox Code Playgroud)
它给了我下一个错误:
Could not cast value of type 'UITabBarController' (0x1a899b818) to 'UINavigationController'
Run Code Online (Sandbox Code Playgroud)
后来我试着这样做:
let rootViewController = self.window?.rootViewController as! UITabBarController
Run Code Online (Sandbox Code Playgroud)
但是在这种情况下我得到了
UITabBar has no member pushViewController
Run Code Online (Sandbox Code Playgroud)
如何显示/推送我的ViewController,以便它与UINavigationBar一起显示在UITabBar中?
我正在尝试使用安装Pod pod install,它会打印
Setting up CocoaPods master repo
Run Code Online (Sandbox Code Playgroud)
而且时间太长,没有安装任何东西。那是一个错误还是我的错误?我可以解决这个问题吗?
我在Objective C中有代码:
NSMutableArray* paths = [textView.textContainer.exclusionPaths mutableCopy];
Run Code Online (Sandbox Code Playgroud)
现在当我尝试将其转换为Swift时:
self.textView.textContainer.exclusionPaths(mutableCopy())
Run Code Online (Sandbox Code Playgroud)
它给了我错误:
Cannot call value of non-function type '[UIBezierPath]'
Run Code Online (Sandbox Code Playgroud)
我怎么转换它?
我也尝试过:
self.textView.textContainer.exclusionPaths.mutableCopy()
Run Code Online (Sandbox Code Playgroud)
但exclusionPaths没有mutableCopy()方法
ios ×3
swift ×3
api ×1
cocoapods ×1
curl ×1
objective-c ×1
pocket ×1
podfile ×1
python ×1
storyboard ×1