UILabel don't display - ios

I have UILabel in my storyboard wanna show a very long string.But it did not show up.
When I insert a "hello world ",it shows up.however, insert a long string what i want to show , it did not work.
import UIKit
class VersionInformationViewController: UIViewController {
#IBOutlet weak var version: UILabel!
static func instantiateViewController() -> VersionInformationViewController {
let storyboard = UIStoryboard(name: "VersionInformation", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "versionInformation") as! VersionInformationViewController
return vc
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
fetchLibraryLicense()
}
// MARK: - private
private func fetchLibraryLicense(){
var VersionInformation:String = "";
let dictionary = NSDictionary(contentsOfFile: Bundle.main.path(forResource: "CarthageLicenseList", ofType: "plist")!);
let array = dictionary?["PreferenceSpecifiers"] as! NSArray
for dic in array {
let dictionary = dic as! NSDictionary
let title:String = (dictionary["Title"] as? String)!
let footerText:String = (dictionary["FooterText"] as? String)!
VersionInformation = VersionInformation + title + footerText
}
print(VersionInformation)
version.text = "hello world" //it works
version.text = VersionInformation // it did not work
}
}

Related

Swift - passing data from VC to detail VC with Firestore

I'm totally new to Swift well I have a View Controller, where a uitableview of data is being fetched from the Firestore and I want to send this data from View Controller to detail View Controller. I mean, when a cell in View Controller is clicked, detail View Controller shows such as name, description from Firestore.. is there anyone to help me?
here's HospitalViewController.Swift :
class HospitalViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
struct HospitalData {
var Name: String = ""
var Image: String = ""
var Region: String = ""
func getDic() -> [String:String] {
let dic = [
"Name": self.Name,
"Image": self.Image,
"Region": self.Region
]
return dic
}
}
var hospitalArray: Array<HospitalData> = []
#IBOutlet weak var hospitalTableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.isNavigationBarHidden = true
hospitalTableView.delegate = self
hospitalTableView.dataSource = self
}
#IBAction func onBtnRead(_ sender: UIButton) {
getValueFromList()
}
func getValueFromList() {
hospitalArray.removeAll()
let db = Firestore.firestore()
db.collection("Hospital").getDocuments() {
(querySnapshot, err) in
if let error = err {
print("fail", error)
}else{
print("success")
for document in querySnapshot!.documents {
print("\(document.documentID) => \(document.data())")
let dataDic = document.data() as NSDictionary
let Name = dataDic["Name"] as? String ?? ""
print("Name:", Name)
let Image = dataDic["Image"] as? String ?? ""
print("Image:", Image)
let Region = dataDic["Region"] as? String ?? ""
print("Region:", Region)
var hospital = HospitalData()
hospital.Name = Name
hospital.Image = Image
hospital.Region = Region
self.hospitalArray.append(hospital)
}
self.hospitalTableView.reloadData()
}
}
}
func setValueIntoList() {
var hospital = HospitalData()
hospital.Name = "SUN Hospital"
hospital.Image = "hospital.png"
hospital.Region = "Seoul"
let dic = hospital.getDic()
let db = Firestore.firestore()
var ref: DocumentReference? = nil
ref = db.collection("Hospital").addDocument(data: dic) {
err in
if let error = err {
print("fail", error)
}else{
print("success", ref!.documentID)
}
}
}
// mark: datasource
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.hospitalArray.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = hospitalTableView.dequeueReusableCell(withIdentifier: "hosptialTableViewCell", for: indexPath) as! HospitalTableViewCell
let hospitalStruct = self.hospitalArray[indexPath.row]
cell.labelName.text = hospitalStruct.Name
cell.labelRegion.text = hospitalStruct.Region
cell.hospitalImageView.image = UIImage(named: "hospital.png")
return cell
}
To navigate from one viewcontroller to others you can use the basic push navigation as bellow
let viewController = UIStoryboard.init(name: "YOUR_STORYBOARD", bundle: Bundle.main).instantiateViewController(withIdentifier: "YOUR_VC_IDENTIFIER") as? YOUR_VC
self.navigationController?.pushViewController(viewController, animated: true)
Now to pass data from one view to the viewcontroller you would like to move you have to declare a variable on the viewcontroller you would like to move.
i.e
You need to have a variable in your detail vc.
hospital_detail_vc.swift
var hospitalData: HospitalData?
Now you need to pass the data/variable as below through the navigation in your TableView's method didSelectRowAt as below.
let viewController = UIStoryboard.init(name: "YOUR_STORYBOARD", bundle: Bundle.main).instantiateViewController(withIdentifier: "YOUR_VC_IDENTIFIER") as? YOUR_VC
viewController.hospitalData = self.hospitalArray[indexPath.row]
self.navigationController?.pushViewController(viewController, animated: true)
Happy coding :)

Passing data from a class to same instance of a viewcontroller

When a specific event happens(in my case when a tab bar is changed) I want to create a new link from an Array. I have gotten this to work but the problem I am not facing is when i try to pass the generated link to the same viewcontroller i get an error
fatal error: unexpectedly found nil while unwrapping an Optional value
This happens when I try to change the UILabel movietitle and imageview. I think this is because every time it sends the link it creates a new ViewController instead of using the existing one. Might also be that i have missed an unwrapped value somewhere. Hope someone here can help me!
StringBuilder:
import UIKit
class StringBuilder: NSObject {
let urlString = "https://api.themoviedb.org/3/discover/movie?api_key=935f539acb9e5534ddeed3fb57e&language=en-US&sort_by=popularity.desc&include_adult=false&include_video=false&page=1&with_genres=12"
let urlStringMultipleGenres = "https://api.themoviedb.org/3/discover/movie?api_key=935f539acbf5534ddeed3fb57e&language=en-US&sort_by=popularity.desc&include_adult=false&include_video=false&page=1&with_genres=28,12,10749"
var currentGenreArray: Array<Int> = []
//This will be run after the user has selected or deselected genres in the genreControllerView
func updateGenres(genreArrayIn: Array<Int>){
print("update genres input: ")
print(genreArrayIn)
//If new array input is the same as old arrayinput, do nothing
if genreArrayIn == currentGenreArray{
return
}
else{
let returnedLink = generateString(genreID: genreArrayIn)
print("Returned link after generate string" + returnedLink)
sendLink(link: returnedLink)
}
}
//After the updated genres have been put into an Array, this function will generate the whole string which
//will be the main String the getMovieRequest follows
func generateString(genreID: Array<Int>) -> String{
let filteredGenreArray = filterZeroes(unfilteredArray: genreID)
currentGenreArray = genreID
print("current genre array: ")
print(currentGenreArray)
let baseString = "https://api.themoviedb.org/3/discover/movie?api_key=935f539acbfed4ddeed3fb57e&language=en-US&sort_by=popularity.desc&include_adult=false&include_video=false&page=1&with_genres="
var generatedString = baseString
for id in filteredGenreArray{
let k = String(id)
generatedString += k + ","
}
print("Generated Link from Strinbuilder: ")
print(generatedString)
return generatedString
}
func filterZeroes(unfilteredArray: Array<Int>) -> Array<Int>{
let filteredGenreArray = unfilteredArray.filter {$0 > 0}
print("filtered array: ")
print(filteredGenreArray)
return filteredGenreArray
}
func sendLink(link: String){
let storyBoard = UIStoryboard(name: "Main", bundle: nil)
let movieVC = storyBoard.instantiateViewController(withIdentifier: "movieView") as! ViewController
movieVC.getMovieData(activeGenreLink: link)
print("new link sent from sendlink()")
}
}
ViewController:
import UIKit
import Alamofire
import AlamofireImage
class ViewController: UIViewController{
static let sharedInstance = ViewController()
var movieIndex = 0
var movieArray:[Movie] = []
var downloadGrp = DispatchGroup()
#IBOutlet var uiMovieTitle: UILabel!
#IBOutlet var uiMoviePoster: UIImageView!
#IBOutlet var posterLoading: UIActivityIndicatorView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let firstTimeLink = "https://api.themoviedb.org/3/discover/movie?api_key=935f539acb9e5534ddeed3fb57e&language=en-US&sort_by=popularity.desc&include_adult=false&include_video=false&page=1&with_genres=35,18"
getMovieData(activeGenreLink: firstTimeLink)
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(imageTapped(tapGestureRecognizer:)))
uiMoviePoster.isUserInteractionEnabled = true
uiMoviePoster.addGestureRecognizer(tapGestureRecognizer)
print("settings Sucessful")
}
func imageTapped(tapGestureRecognizer: UITapGestureRecognizer){
performSegue(withIdentifier: "detailsSegue", sender: self)
}
#IBAction func yesBtn(_ sender: UIButton) {
movieIndex += 1
updateUI()
}
#IBAction func seenBtn(_ sender: UIButton) {
movieIndex += 1
}
#IBAction func noBtn(_ sender: UIButton) {
movieIndex += 1
}
//Get movie data
func getMovieData(activeGenreLink: String){
//self.posterLoading.startAnimating()
movieIndex = 0
self.downloadGrp.enter()
Alamofire.request(activeGenreLink).responseJSON { response in
//print(response.request) // original URL request
//print(response.response) // HTTP URL response
//print(response.data) // server data
//print(response.result) // result of response serialization
self.movieArray = []
print(self.movieArray)
if let json = response.result.value as? Dictionary<String,AnyObject> {
if let movies = json["results"] as? [AnyObject]{
for movie in movies{
let movieObject: Movie = Movie()
let title = movie["title"] as! String
let releaseDate = movie["release_date"] as! String
let posterPath = movie["poster_path"] as! String
let overView = movie["overview"] as! String
let movieId = movie["id"] as! Int
let genre_ids = movie["genre_ids"] as! [AnyObject]
movieObject.title = title
movieObject.movieRelease = releaseDate
movieObject.posterPath = posterPath
movieObject.overView = overView
movieObject.movieId = movieId
for genre in genre_ids{//Genre ids, fix this
movieObject.movieGenre.append(genre as! Int)
}
Alamofire.request("http://image.tmdb.org/t/p/w1920" + posterPath).responseImage {
response in
//print(response.request)
//print(response.response)
//debugPrint(response.result)
if var image = response.result.value {
image = UIImage(data: response.data!)!
movieObject.poster = image
}
}
self.movieArray.append(movieObject)
}//End of for each movie
}
else{
print("error while making results anyobject")
}
}
else{
print("error while trying to make NSDictionary")}
self.downloadGrp.leave()
}//End of Json request
downloadGrp.notify( queue: .main){
print("all downloads finished")
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(3)) {
print(self.movieArray[0].title!)
self.updateUI()
print("updatedUI")
}
}
}//End of getmoviedata
override func prepare(for segue: UIStoryboardSegue,sender: Any?){
// Create a variable that you want to send
let currentMovie = self.movieArray[movieIndex]
if let destinationVC = segue.destination as? DetailsViewController{
destinationVC.currentMovie = currentMovie
}
}
func updateUI(){
//self.posterLoading.stopAnimating()
if uiMoviePoster == nil{
print(uiMovieTitle.debugDescription)
}
else{
print("first time debugID: " + uiMovieTitle.debugDescription)
uiMovieTitle.text = self.movieArray[movieIndex].title
uiMoviePoster.image = self.movieArray[movieIndex].poster
}
}
}
You want to grab a sharedInstance not instantiate from a storyboard
let movieVC = ViewController.sharedInstance()
but I still do not understand why do you need to do it like this

Firebase dispatch_async keeps crashing -swift 2 iOS9

I'm using a tabBar Controller. TabOne is the rootVC. In TabOne I have a viewController that is sending info to Firebase via a sendButton and programmatically presenting TabTwo.
In TabTwo I have tableView controller that gets the info and displays it. Oddly twice I ran the code and everything was fine, I pressed the sendButton, TabTwo gets presented, it's tableview correctly loads the cells with the correct info. The problem is now for some strange reason it only successfully ran those 2 times and it has been crashing on dispatch_async ever since.
Now I just tried to run the simulator and instead of pressing the sendButton in TabOne I pressed the tab for TabTwo and the app crashes on dispatch_async. I didn't attempt to send anything to Firebase, I just clicked the tab for TabTwo and dispatch_async crashed with code:
Thread1: EXC_BAD_INSTRUCTION (code=EXC_1338_INVOP, subcode=0x0)
Any idea why it seems to crash when I switch tabs?
Any idea why everything ran fine twice then all of a sudden crash?
Here is the code:
ModelObject
class CookieModel: NSObject{
var name: String?
}
tab1
class TabOneController: UIViewController{
var dbRef: FIRDatabaseReference!
let userID: String? = (FIRAuth.auth()?.currentUser?.uid)!
let cookieModel = [CookieModel]()
override func viewDidLoad() {
super.viewDidLoad()
self.dbRef = FIRDatabase.database().reference()
}
#IBAction func sendButton(sender: UIButton){
self.sendToFireBase()
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let tabBarController = mainStoryboard.instantiateInitialViewController() as! UITabBarController
tabBarController.selectedIndex = 1
self.presentViewController(tabBarController , animated: true, completion: nil)
}
//Code to send data to FirebaseDatabase
func sendToFireBase(){
let uniquePath = NSUUID().UUIDString
let usersIDRef = self.dbRef.child("users").child(self.userID!)
let cookiePath = usersIDRef.child("cookieData").child(self.uniquePath)
let cookie0 = CookieModel()
cookie0.name = "oatmeal"
self.cookieModel.append(cookie0)
let cookie1 = CookieModel()
cookie1.name = "chocolate"
self.cookieModel.append(cookie1)
let cookie2 = CookieModel()
cookie2.name = "coconut"
self.cookieModel.append(cookie2)
var cookieDict = [String:AnyObject]()
cookieDict.updateValue(cookie0.name!, forKey: "cookie0")
cookieDict.updateValue(cookie1.name!, forKey: "cookie1")
cookieDict.updateValue(cookie2.name!, forKey: "cookie2")
cookiePath.updateChildValues(cookieDict, withCompletionBlock: {
(error, user) in
if error != nil{
print((error?.localizedDescription))
return
}
}
}
tab2
class TabTwoController: UIViewController, UITableViewDataSource, UITableViewDelegate{
#IBOutlet weak var tableView: UITableView!
var dbRef: FIRDatabaseReference!
let userID: String? = (FIRAuth.auth()?.currentUser?.uid)!
var cookieModel = [CookieModel]()
override func viewDidLoad() {
super.viewDidLoad()
self.dbRef = FIRDatabase.database().reference()
self.tableView.delegate = self
self.observeFBCookieData()
}
//Code to retrieve data from FirebaseDatabase
func observeFBCookieData(){
let usersIDRef = self.dbRef.child("users").child(self.userID!)
let cookiePath = usersIDRef.child("cookieData")
cookiePath.observeEventType(.ChildAdded, withBlock: {
(snapshot) in
if let dict = snapshot.value as? [String:AnyObject]{
let cookie0 = dict["cookie0"] as? String
let cookie1 = dict["cookie1"] as? String
let cookie2 = dict["cookie2"] as? String
let cookie0 = CookieModel()
cookie0.name = cookie0!
self.cookieModel.append(cookie0)
let cookie1 = CookieModel()
cookie1.name = cookie1!
self.cookieModel.append(cookie1)
let cookie2 = CookieModel()
cookie2.name = cookie2!
self.cookieModel.append(cookie2)
dispatch_async(dispatch_get_main_queue(), {
self.tableView.reloadData()
})
}
}, withCancelBlock: nil)
}
//MARK: -TableViewDatasource Methods
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.cookieModel.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! MyCookieCell
cell.titleLabel.text = self.cookieModel[IndexPath.row].name!
return cell
}
}
Try setting the table view's data source in your viewDidLoad after setting its delegate.
Self.tableView.datasource = self

tableview not refreshing by using notificationcentre and tableview.reloaddata()

here is the code I use to refresh a tableview when I click a delete button on my custom tableview cell by using notificationcenter and tableview.reloaddata(). I have searched a bunch of other codes and i think my code looks fine. I don't know why it just doesn't refresh.
This is where my tableview is
override func viewDidLoad() {
super.viewDidLoad()
username = tempUser.username
self.resultSearchController = ({
let controller = UISearchController(searchResultsController: nil)
controller.searchResultsUpdater = self
controller.dimsBackgroundDuringPresentation = false
controller.searchBar.sizeToFit()
self.tableView.tableHeaderView = controller.searchBar
return controller
})()
get{(value) in
self.values = value
for ele in self.values{
if self.username != ele["username"] as! String{
}
}
}
self.tableView.reloadData()
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(serviceBoard.methodhandlingTheNotificationEvent), name:"NotificationIdentifie‌​r", object: nil)
}
func methodhandlingTheNotificationEvent(){
tableView.reloadData()
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if (self.resultSearchController.active && resultSearchController.searchBar.text != "") {
return self.filteredTableData.count
}
else {
return values.count
}
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as!postCell
let maindata = values[values.count-1-indexPath.row]
if (self.resultSearchController.active && resultSearchController.searchBar.text != "") {
// if (filteredTableData[indexPath.row].rangeOfString("###") == nil){
cell.postImg.image = UIImage(named:"tile_services")
cell.title.text = filteredTableData[indexPath.row]
cell.category.text = "SERVICES"
var price = String()
for i in values{
if (i["title"] as? String)! == filteredTableData[indexPath.row]{
price = (i["price"] as? String)!
cell.categories = "Services"
cell.username = i["username"] as! String
cell.prices = i["price"] as! String
cell.notes = i["notes"] as! String
cell.school = i["school"] as! String
}
}
cell.price.text = price
return cell
}
else {
if maindata["username"] as! String != username && username != "admin"{
cell.deleteBtn.hidden = true
}
else{
cell.categories = "Services"
cell.username = maindata["username"] as! String
cell.prices = maindata["price"] as! String
cell.notes = maindata["notes"] as! String
cell.school = maindata["school"] as! String
}
cell.postImg.image = UIImage(named:"tile_services")
cell.title.text = maindata["title"] as? String
cell.category.text = "SERVICES"
cell.price.text = maindata["price"] as? String
return cell
}
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let popOverVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("showPostT") as! showPostT
self.addChildViewController(popOverVC)
popOverVC.view.frame = self.view.frame
self.view.addSubview(popOverVC.view)
popOverVC.didMoveToParentViewController(self)
if (self.resultSearchController.active && resultSearchController.searchBar.text != "") {
for i in values{
if (i["title"] as? String)! == filteredTableData[indexPath.row]{
popOverVC.type.text = "SERVICE"
popOverVC.typeImg.image = UIImage(named:"tile_services")
popOverVC.item.text = "Service: \(i["title"] as! String)"
popOverVC.price.text = "Price: \(i["price"] as! String)"
popOverVC.notes.text = "Notes: \(i["notes"] as! String)"
popOverVC.comments.text = i["comments"] as? String
popOverVC.postUser.text = i["username"] as! String
popOverVC.notesStr = i["notes"] as! String
popOverVC.category = "service"
popOverVC.pricesStr = i["price"] as! String
if username == popOverVC.postUser.text!{
popOverVC.composeBtn.hidden = true
}
}
}
}
else{
let maindata = values[values.count-1-indexPath.row]
popOverVC.type.text = "SERVICE"
popOverVC.typeImg.image = UIImage(named:"tile_services")
popOverVC.item.text = "Service: \(maindata["title"] as! String)"
popOverVC.price.text = "Price: \(maindata["price"] as! String)"
popOverVC.notes.text = "Notes: \(maindata["notes"] as! String)"
popOverVC.comments.text = maindata["comments"] as? String
popOverVC.postUser.text = maindata["username"] as! String
popOverVC.notesStr = maindata["notes"] as! String
popOverVC.category = "service"
popOverVC.pricesStr = maindata["price"] as! String
if username == popOverVC.postUser.text!{
popOverVC.composeBtn.hidden = true
}
}
}
and this is my custom tableview cell
class postCell: UITableViewCell{
#IBOutlet weak var deleteBtn: UIButton!
#IBOutlet weak var postImg: UIImageView!
#IBOutlet weak var category: UILabel!
#IBOutlet weak var location: UILabel!
#IBOutlet weak var title: UILabel!
#IBOutlet weak var price: UILabel!
var prices = String()
var notes = String()
var comments = String()
var locations = String()
var categories = String()
var school = String()
var username = String()
var date = String()
#IBAction func deleteAction(sender: AnyObject) {
let request = NSMutableURLRequest(URL: NSURL(string: "http://www.percyteng.com/orbit/deletePost.php")!)
request.HTTPMethod = "POST"
let postString = "name=\(username)&location=\(locations)&price=\(prices)&notes=\(notes)&school=\(school)&category=\(categories)"
request.HTTPBody = postString.dataUsingEncoding(NSUTF8StringEncoding)
let task = NSURLSession.sharedSession().dataTaskWithRequest(request) {
data, response, error in
if error != nil {
print("error=\(error)")
return
}
print("response = \(response)")
let responseString = NSString(data: data!, encoding: NSUTF8StringEncoding)
print("responseString = \(responseString)")
}
task.resume(); NSNotificationCenter.defaultCenter().postNotificationName("NotificationIdentifie‌​r", object: nil)
}
override func awakeFromNib() {
super.awakeFromNib()
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated:animated)
}
}
It looks like you are not updating the values property when you click on the "Delete" button.
func methodhandlingTheNotificationEvent(){
// you have to update the `values` array so that it doesn't contain the value you've just removed.
tableView.reloadData()
}
Try to reload table in viewDidAppear().
You have to update your data source before reloading tableview then only your tableview will affected otherwise you will always got old table.
I think maindata is main datasource in your cellforrowAtIndexpath. So you have to update or delete from your datasource and then you should reload data.

Put a standard string on a label

I'm currently trying to make a label showing different text for each user, to have a standard text before this label but not inside the cell on the .xib file.
What i've done until know is this
import UIKit
class profileViewController: UIViewController {
#IBOutlet var lblUsersname: UILabel!
#IBOutlet var lblUserspoints: UILabel!
#IBOutlet var imgViewUserAvatar: UIImageView!
var profileJson : [String:AnyObject] = [ : ]
var userid = ""
var usersname = ""
var userspoints = ""
var usersavatar = ""
var pointtxt = "Points: "
override func viewDidLoad() {
super.viewDidLoad()
let defaults = NSUserDefaults.standardUserDefaults()
if let usersid = defaults.stringForKey("usersId") {
userid = usersid
fetchDatas()
lblUsersname.text = usersname
lblUserspoints.text = userspoints
}else{
print("Error")
}
if let checkedUrl = NSURL(string: usersavatar) {
downloadImage(checkedUrl)
}
}
func fetchDatas(){
let urlara = NSLocalizedString("profileRequest", comment: "")
let loginRequest = receiveData(data1: "id=\(userid)", url1: NSURL(string: urlara)!)
profileJson = loginRequest.fetchData()
if let locationsArray = profileJson["profile"] as? [[String:AnyObject]] {
for locationDictionary in locationsArray {
if let name = locationDictionary["name"] as? String {
usersname = name
}
if let points = locationDictionary["points"] as? String {
userspoints = points
}
if let avatar = locationDictionary["avatar"] as? String {
usersavatar = avatar
}
}
}
}
So now it's show only the number of the points
And i'm trying to make it show
Points: lblUserpoints
Anyone has any idea?
After some tryings i find it out. changed the line
lblUserspoints.text = userspoints
to this
lblUserpoints.text = String(pointtxt) + userpoints
And i had the desired output which was
Points: 2910

Resources