swift3

iOS - Display a progress indicator at the center of the screen rather than the view

ぃ、小莉子 提交于 2021-02-10 03:26:17
问题 I want to display a progress indicator at the center of the screen, NOT the view. It should be the center of the view because the view is scrollable. Most answers only tells how to center it in the view. I have this code: let screenBound = UIScreen.main.bounds let progressIndc = UIActivityIndicatorView() progressIndc.frame = CGRect(x: screenBound.width / 2 - 10, y: screenBound.height / 2 - 10, width: 20, height: 20) progressIndc.hidesWhenStopped = true progressIndc.color = UIColor.gray

iOS - Display a progress indicator at the center of the screen rather than the view

我与影子孤独终老i 提交于 2021-02-10 03:23:58
问题 I want to display a progress indicator at the center of the screen, NOT the view. It should be the center of the view because the view is scrollable. Most answers only tells how to center it in the view. I have this code: let screenBound = UIScreen.main.bounds let progressIndc = UIActivityIndicatorView() progressIndc.frame = CGRect(x: screenBound.width / 2 - 10, y: screenBound.height / 2 - 10, width: 20, height: 20) progressIndc.hidesWhenStopped = true progressIndc.color = UIColor.gray

iOS - Display a progress indicator at the center of the screen rather than the view

邮差的信 提交于 2021-02-10 03:23:30
问题 I want to display a progress indicator at the center of the screen, NOT the view. It should be the center of the view because the view is scrollable. Most answers only tells how to center it in the view. I have this code: let screenBound = UIScreen.main.bounds let progressIndc = UIActivityIndicatorView() progressIndc.frame = CGRect(x: screenBound.width / 2 - 10, y: screenBound.height / 2 - 10, width: 20, height: 20) progressIndc.hidesWhenStopped = true progressIndc.color = UIColor.gray

iOS - Display a progress indicator at the center of the screen rather than the view

若如初见. 提交于 2021-02-10 03:21:24
问题 I want to display a progress indicator at the center of the screen, NOT the view. It should be the center of the view because the view is scrollable. Most answers only tells how to center it in the view. I have this code: let screenBound = UIScreen.main.bounds let progressIndc = UIActivityIndicatorView() progressIndc.frame = CGRect(x: screenBound.width / 2 - 10, y: screenBound.height / 2 - 10, width: 20, height: 20) progressIndc.hidesWhenStopped = true progressIndc.color = UIColor.gray

How to display a ViewController when answering a call with CallKit

廉价感情. 提交于 2021-02-08 19:23:14
问题 I have followed the following tutorial to implement CallKit within my app: https://www.raywenderlich.com/150015/callkit-tutorial-ios But I would like to go further, and display my own ViewController while the call is active. I am doing a videocall service so I would like to have my own interface. Is that possible at all? I have been trying to launch the ViewController from the method provider(CXProvider:CXAnswerCallAction) which is the one called when the user answers the call, but it seems

How to display a ViewController when answering a call with CallKit

北慕城南 提交于 2021-02-08 19:22:32
问题 I have followed the following tutorial to implement CallKit within my app: https://www.raywenderlich.com/150015/callkit-tutorial-ios But I would like to go further, and display my own ViewController while the call is active. I am doing a videocall service so I would like to have my own interface. Is that possible at all? I have been trying to launch the ViewController from the method provider(CXProvider:CXAnswerCallAction) which is the one called when the user answers the call, but it seems

When user uses back button to UITableView to scroll to last selected row

青春壹個敷衍的年華 提交于 2021-02-08 10:31:01
问题 I have a tableView with about 200 rows. When a user selects a row to view the details and later hits the back button, the tableView always returns to the top of the table. I would like to set up the tableView to force the tableView to auto scroll to the row in which the user last selected. How to do this? 回答1: I would suggest storing selected NSIndexPath in the didSelectRowAtIndexPath method (when user presses on a cell). Then in viewWillAppear or viewDidAppear method (in view controller

How to filter an array using NSPredicate in swift 3

自闭症网瘾萝莉.ら 提交于 2021-02-08 08:43:49
问题 I have an arraycontaining several dictionaries. { DisplayName?:"Name of the employee" Age:28 Department:"Dept 2" } I just converted my objective-c code into swift and trying to filter like this. let exists = NSPredicate(format: "DisplayName2 CONTAINS[cd] \(searchText!)") let aList: Array<Any> = arrayDirectory.filter { exists.evaluate(with: $0) } if(aList.count>0) { arrayDirectory=aList facesCarousel.reloadData() } But I am always getting the aList count as 0. It seems like not filtering my

How to save data in current uid in Firebase

故事扮演 提交于 2021-02-08 08:23:48
问题 I can't save new data ("messages") to current user. my code for push user info to Firebase var ref: FIRDatabaseReference! = FIRDatabase.database().reference() self.ref.child("Users").child("UserID").childByAutoId().setValue(["Name": userName, "Email": userEmail]) code for push messages to Firebase var messageRef: FIRDatabaseReference = FIRDatabase.database().reference() let uid = FIRAuth.auth()?.currentUser?.uid messageRef.child("Users").child("UserID").child(self.uid!).child("Messages")

swift 3 call function from parent ViewController

时光总嘲笑我的痴心妄想 提交于 2021-02-08 07:38:34
问题 I have a ViewController, this view container has a class which creates 2 container views, and adds a table to the first container and a HashtagPicker for the second. The hashTagPicker has a function which is called whenever a change to the selected hashTags happens. question : i want to call a update table function whenever a tag is changed. How can i call a function from the hashtagclass which is defined in the class that contains the containers? 回答1: I personally like the delegate approach