swift3

Move View when keyboard appears and present it in a scrollView. Swift 3

别来无恙 提交于 2019-12-12 05:36:29
问题 There are several similar questions on SO but non addresses the issue below. I'm working on a simple login view with just 2 textFields for email and password. The best UX is when a user taps one of the textFields, the keyboard pops in, and the view moves up, while becoming a scrollView. This way, a user can still see what other UI elements are on the screen. User should also be able to hide the keyboard by swiping down. (Instagram and other big boys have this implemented) I was able to built

YouTube embedded video displaying wrong size

吃可爱长大的小学妹 提交于 2019-12-12 05:32:21
问题 I have embedded a youtube video in a UIWebView for display in my app. Here's the code for that: func loadVideo(){ if let youtubeCode = exerciseYoutubeCode { guard !youtubeCode.isEmpty else { return } exerciseVideoWebView.isHidden = false exerciseVideoWebView.allowsInlineMediaPlayback = true exerciseVideoWebView.scrollView.isScrollEnabled = false exerciseVideoWebView.scrollView.bounces = false exerciseVideoWebView.loadHTMLString("<html><head><style>body{margin:0px}</style></head><body><iframe

How to integrate and trigger Callkit in ios Objective c

左心房为你撑大大i 提交于 2019-12-12 05:30:01
问题 Now, I want to integrate CallKit Framework iOS(10.0) to this application, but my existing code is in Objective-C language. I have searched many forums, but all of them are in Swift language. I am also try to integrate with speaker box which is in iOS Swift https://developer.apple.com/library/content/samplecode/Speakerbox/Introduction/Intro.html. But i tried to do bridging the swift files into my project like #import "productname-Swift.h" into my .m files wherever i need, and i placed the

Swift sending Multiple Objects to View Controller

99封情书 提交于 2019-12-12 05:28:39
问题 I am trying to send multiple objects from my initial view controller to my Username VC . Here is the segue code from my controllers: The issue comes when I add in the code to send the second object, termreport . If I delete the termsM and the assignment, it send the students as usually, but I also need to send the termReport object. How would I fix this? ViewControler : override func prepare(for segue: UIStoryboardSegue, sender: Any?) { guard let students = sender as AnyObject as? [Student]

Cannot assign value of type '[SKNode]' to type 'SKSpriteNode!'

二次信任 提交于 2019-12-12 05:28:23
问题 I'm writing a Galaga-style game in Swift 3 with SpriteKit and I keep getting an error that says Cannot assign value of type '[SKNode]' to type 'SKSpriteNode!' Can anyone explain what this means so that I can fix it myself in the future and also give me a possible solution? Here's the function where I get the error: override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { for touch in touches { let location = (touch as UITouch).location(in: self) if fireButton = self.nodes

how to dynamically increase the height of scroll view?

感情迁移 提交于 2019-12-12 05:27:57
问题 i placed a table view and a view in a scroll view how to change the scroll view's height dynamically depending on the number of cells in the table view and the content present in content view also 回答1: You need to set contensize of your ScrollView. You can do it by proper autolayout or programatically as CGRect contentRect = CGRectZero; for (UIView *view in self.scrollView.subviews) { contentRect = CGRectUnion(contentRect, view.frame); } self.scrollView.contentSize = contentRect.size; In

Aspect ratio constraint relative to the screen width

随声附和 提交于 2019-12-12 05:18:05
问题 I have set a cell image to my UITableViewCell . It is a custom cell. I have set the aspect ratio as 1:1 and the width of the image view to 50. But for iphone 5 and 5s this size is too big as I feel. So how can I change the size of the UIImageView relative to the screen width. Please help me. Thanks This is my current view 回答1: There are at least 2 ways you could configure image size based on the screen size: Size-Classes allows you to set different width constraint value based on Trait

request Facebook friends return empty

女生的网名这么多〃 提交于 2019-12-12 05:17:08
问题 I have two Facebook accounts(friends) and I logged in and authorized my app in both. But when I try to request friends from any of them I get an empty list. Can this be related to the fact that my app still in development? granted permissions = [AnyHashable("user_friends"), AnyHashable("contact_email"), AnyHashable("email"), AnyHashable("public_profile"), AnyHashable("user_birthday")] my code: FBSDKGraphRequest(graphPath: "/me/friends", parameters: nil).start(completionHandler: { (connection,

AWS Cognito integration swift3 Refresh provides ResourceNotFoundException

人盡茶涼 提交于 2019-12-12 05:14:19
问题 Following the answer here: https://github.com/aws/aws-sdk-ios/issues/357 At the very bottom there is a mini guide on getting swift and cognito working. I've made a AWSCustomIdentityProvider as such: import Foundation import AWSCognitoIdentityProvider import AWSCognito class AWSCustomIdentityProvider: NSObject, AWSIdentityProviderManager { private var dict = NSDictionary() func addToken(value:NSString) { dict = ["graph.facebook.com":value] } public func logins() -> AWSTask<NSDictionary> {

How to set tableview cell separator to 100% width in Swift 3.0?

蓝咒 提交于 2019-12-12 05:10:00
问题 I'm developing my first app, and have got everything working except I have discovered a display issue on iPad, where the separator of a cell is limited in width (see screenshot) Screen shot on iPad I've tried everything that I can find on how to set the margins to 0, etc, including: override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let myCell = tableView.dequeueReusableCell(withIdentifier: "cellId", for: indexPath) as! MyCell myCell