swift3

CollectionViewCell image doesn't display until scrolling

老子叫甜甜 提交于 2019-12-11 14:55:15
问题 I am using this code to display image in to my customCell. This is my code to fetch image from API. It was working fine as per the given link. But the problem started when I added this code to my cellForItemAt indexPath: for image Cache. func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { // Displaying other elements with text customCell.mainImage.image = nil var image1 = self.imageCache.object(forKey: indexPath.item as

Custom Class of UITextView Not Hooking Up

ⅰ亾dé卋堺 提交于 2019-12-11 14:54:09
问题 I have a TextView that has a custom class of "BulletedTextView". Here is a screenshot of what is entered into the Storyboard File. Although, when I go into the simulator, it does not appear that it is connected at all. And, it just allows me to put multiple lines with no bullet. It should have multiple lines, and bullets on each of them, according to my code. This same code works in one of my other apps and it works just fine, no issues. Here is my code: import UIKit class BulletedTextView:

Firebase google auth (swift)

我怕爱的太早我们不能终老 提交于 2019-12-11 14:28:30
问题 Following the firebase docs i added the authentication with google account and this is part of the code that i have in my app delegate func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error?) { if let error = error { print("Failed to log into Google: ", error) return } print("Successfully logged into Google", user) guard let idToken = user.authentication.idToken else { return } guard let accessToken = user.authentication.accessToken else { return } let

How to Play a video in AVPlayer for a specific duration in Swift3 iOS

走远了吗. 提交于 2019-12-11 14:18:38
问题 I am creating a Video application in Swift3 . Where we have a list of Video files in a TableView list. For each Video we have given Range Slider option for user to select Range of the Video . Now I am trying to play the Video for that specific range, selected by the User. I am using below code to start a Video from 4 Seconds to 8 Seconds using CMTimeMake but not playing correctly. let targetTime:CMTime = CMTimeMake(4, 1)////Video start self.player?.seek(to: targetTime) self.player?

Add Trick Play feature with AVPlayerViewController in Swift

北城以北 提交于 2019-12-11 10:38:47
问题 I implemented a video player function with AVPlayer in Swift 3. Currently, I can play the video well. I would like to add the feature of " Trick Play " with the speed of 2x,3x,4x . However, I didn't find anything googling. Can anyone help me please? 回答1: Try playerViewController.player!.rate = 2 // 3, 4 etc 来源: https://stackoverflow.com/questions/42973856/add-trick-play-feature-with-avplayerviewcontroller-in-swift

Updating TableView within containerview

旧巷老猫 提交于 2019-12-11 09:28:52
问题 I have my UIViewController , which is a person's profile page, it displays their name and picture. Within that UIViewController I have a UIContainerView that displays a static UITableView . I'm having a little trouble updating the cells of the table when the profile page loads. Here's my storyboard: I have tried the following, within my UIViewController . I created an outlet to my UIView and passed the person object to it. In my UIView I called the segue to pass the object to the

How to access buttons in a UICollectionView from a target function set (Swift 3)

。_饼干妹妹 提交于 2019-12-11 08:54:02
问题 In my View Controller, I have a collection view that, when rendered, displays 3 cells, each of which has a label, and a button. The label displays the name of a color, and the button has a background image that displays a color swatch. I want it so that whenever you click on one of the buttons, that button gets a dark border around it, while the other buttons get a light border on them, to indicate the clicked-on button as being "selected". Alternately, I could probably do this by changing

How to read data from file placed in server through url link in ios swift (4)?

两盒软妹~` 提交于 2019-12-11 08:47:46
问题 I have written code for retrieving data from file or download that file and show in your phone. But I don't understand why it is not displaying data. When I opened that file it shows blank and but it is printing some hexadecimal code in a console. I am very new to this IOS development, kindly please help me this. I want to retrieve data from the server through a link, and display it on the mobile. Thanks in advance you can help with some alternate way. Below is my code let username = "xxxx"

Can't click button inside UITableViewCell?

谁说我不能喝 提交于 2019-12-11 08:45:09
问题 I'm using storyboard to create a UITableView, loading up some data to recommend users to follow, and including a follow button inside the cell. Only problem is, I'm not able to click the follow button inside the cell. Here's the code for the TableView in my ViewController class (It isn't a TableViewController, it's a UIViewController that includes UITableViewDelegate and UITableViewDataSource): func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return

Access nested stack views

不想你离开。 提交于 2019-12-11 08:39:51
问题 Obviously overseeing something simple. Need to access a nested stack view in another stack view. If I wanted to set spacing to all nested stackViews for passenger 2 how would I do that? // Select passenger 2 let tag = 2 // Select wrapper stackView for passenger 2 let stackView = self.view.viewWithTag(tag) as! UIStackView! let nestedStackViews = stackView. <-- WHAT GOES HERE?? for sv in nestedStackViews{ sv?.spacing = 0 // Set nested stackView spacing to 0 to avoid constraint issues } To