কম্পিউটার টিউটোরিয়াল

iOS-এ গোলাকার কোণাযুক্ত TableView তৈরি করা


UITableView-কে রাউন্ডেড কর্নার দিন

টেবল ভিউ iOS-এ সবচেয়ে মৌলিক UI কম্পোনেন্ট। এটিকে রাউন্ডেড কর্নার দেওয়া খুব সহজ—শুধু লেয়ারের cornerRadius সেট করলেই হয়।

স্টোরিবোর্ড সেটআপ

  1. Single View App তৈরি করুন।
  2. Main.storyboard-এ UITableView যোগ করুন।
  3. প্রোটোটাইপ সেল যোগ করে রিইউজ আইডেন্টিফায়ার "cell" দিন।
  4. কাস্টম UITableViewCell সাবক্লাস তৈরি করুন (ঐচ্ছিক)।

ViewController কোড

import UIKit

class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
    @IBOutlet var tableView: UITableView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.dataSource = self
        tableView.delegate = self
        
        // রাউন্ডেড কর্নার
        tableView.layer.cornerRadius = 10
        tableView.layer.masksToBounds = true  // কনটেন্ট ক্লিপ করতে
        tableView.backgroundColor = .cyan
    }
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 5
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
        cell.textLabel?.text = "Row \(indexPath.row)"
        return cell
    }
    
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 80
    }
}

টিপস: masksToBounds = true না দিলে সেলের কনটেন্ট কর্নারের বাইরে চলে যাবে।


  1. HTML-এ ক্যাপশন (Caption) সহ টেবিল তৈরি করা

  2. HTML-এ বিব্লিওগ্রাফি (Bibliography) তৈরি করা

  3. HTML5 SVG-এ বৃত্তাকোণবিশিষ্ট আয়তক্ষেত্র কীভাবে তৈরি করবেন?

  4. অ্যান্ড্রয়েড এবং আইওএসে YouTube Shorts তৈরি করার পদ্ধতি