Post

Replies

Boosts

Views

Activity

Reply to Need help for lesson 14
IMHO, this is not a very good code. What is the interest to transform a Bool into String to later look for "true" or "false", instead of testing the Bool directly ? Note: when you post code, use the code formatter tool () to present it properly.
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to AppKit.NSOutlineView: How to get width of indentation marker(disclosure triangle) area
I need to know row view width in column I'm not totally sure, but this func should directly return the frame without the disclosure button: func frameOfOutlineCell(atRow row: Int) - NSRect Is it what you are looking for ? If you want the size of disclosure area, you could : loop through all subviews of the NSOutlineView, searching for buttons. Disclosure buttons should be there. Have a look at this post, which could help find the solution: https ://www.reddit. com/r/swift/comments/e2xi4n/position_of_a_disclosure_button_inside/
Topic: UI Frameworks SubTopic: AppKit Tags:
Mar ’21
Reply to How to can we add expand and collapse cell at the bottom of tableview in swift
You asked 2 hours ago and request again 15' later ! Come on, no one is there just to rush on your questions. 😉 And you'd better clarify your problem. two cells are expandable and others are not. So, you have cells A, B which are expandendable And cells D, E, F below are not. Correct ?  I need when i click on expandable cell it should show cells under it and on clicking again it should hide What is it you don't know how to do ? What is the problem exactly ? To hide, you should set hidden to true for cells C, D, E and set their height to zero. See this: https://stackoverflow.com/questions/29886642/hide-uitableview-cell
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to Delete record without navigate another controller
but in delete operation we have no need to navigate another controller just click on button action will be performed Where do you navigate to ? Is it UpdateViewController ? Which button do you tap ? Note: When you format code, take care to format in a single chunk. It is easier to read: func deleteData(id:String){ let fetchRequest = NSFetchRequestNSManagedObject(entityName: "User") fetchRequest.predicate = NSPredicate(format: "id = '\(id)'") do { let test = try context.fetch(fetchRequest) let objectToDelete = test[0] context.delete(objectToDelete) do { try context.save() } catch(let error) { print(error.localizedDescription) } } catch(let error) { print(error) } } class SecondViewController: UIViewController,UITableViewDelegate,UITableViewDataSource { var array = [DictionaryString,String]() @IBOutlet weak var tableview: UITableView! var id = "" var obj = DictionaryString,String() override func viewDidLoad() { super.viewDidLoad() self.tableview.delegate = self self.tableview.dataSource = self array = DataHandler.sharedInstance.fetch() } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) - Int { return array.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) - UITableViewCell { let obj = array[indexPath.row] let cell = tableView.dequeueReusableCell(withIdentifier: "cell") as! TableViewCell cell.usernameLabel.text = obj["username"] cell.emailLabel.text = obj["email"] cell.passwordLabel.text = obj["password"] cell.updateBtn.addTarget(self, action: #selector(didTapUpdateBtn(sender:)), for: .touchUpInside) cell.updateBtn.tag = indexPath.row return cell } @objc func didTapUpdateBtn(sender:UIButton) { let obj = array[sender.tag] let sb = UIStoryboard.init(name: "Main", bundle: nil) let vc = sb.instantiateViewController(identifier: "update") as! UpdateViewController vc.obj = obj self.present(vc, animated: true, completion: nil) }
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21