Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > Mobile > Mobile Forum > iOS - How to create more than one UITableView with cell action in single view controller.



 

iOS - How to create more than one UITableView with cell action in single view controller.

 



Topic : 098881



โพสกระทู้ ( 274 )
บทความ ( 0 )



สถานะออฟไลน์




How to create more than one uitableview with cell action in single view controller. Please Help!



Tag : Mobile, iOS, iPhone, Objective-C







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-08-08 17:29:05 By : vishwa View : 1142 Reply : 5
 

 

No. 1



โพสกระทู้ ( 114 )
บทความ ( 0 )



สถานะออฟไลน์


use uiviewcontroller

and create uitableview in uiviewcontroller






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-09 11:09:43 By : LindyFralin
 


 

No. 2



โพสกระทู้ ( 274 )
บทความ ( 0 )



สถานะออฟไลน์


Thanks LindyFralin.

Now working perfect but I'm using this method

http://www.allappsdevelopers.com/TopicDetail.aspx?TopicID=b9c3f8dd-8bf6-4244-8e56-5cdbd7c62979
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-09 11:28:54 By : vishwa
 

 

No. 3



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-09 11:32:16 By : mr.win
 


 

No. 4



โพสกระทู้ ( 114 )
บทความ ( 0 )



สถานะออฟไลน์


my project some uiviewcontroller with uitableview about 6 - 7 tableview
i think if use tag for control uitableview. it hard to remember table tag

.h
@property (strong, nonatomic) IBOutlet UITableView *tableView1;
@property (strong, nonatomic) IBOutlet UITableView *tableView2;
@property (strong, nonatomic) IBOutlet UITableView *tableView3;
@property (strong, nonatomic) IBOutlet UITableView *tableView4;
@property (strong, nonatomic) IBOutlet UITableView *tableView5;
@property (strong, nonatomic) IBOutlet UITableView *tableView6;


.m
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(tableView==tableView1){

    }else if(tableView==tableView2){

    }else .......

}


i think easy to control and remember


ประวัติการแก้ไข
2013-08-09 11:52:13
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-09 11:50:43 By : LindyFralin
 


 

No. 5



โพสกระทู้ ( 274 )
บทความ ( 0 )



สถานะออฟไลน์


Yes mr.lindyfralin i use that method only

Code (Objective-C)
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if(tableView == tableView1){
    return displayObject.count;
    }else if(tableView == tableView2){
        return 5;
    }
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
      
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle : UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
        cell.opaque = NO;
        cell.textLabel.backgroundColor = [UIColor clearColor];
        cell.detailTextLabel.backgroundColor = [UIColor clearColor];
    }
    
    if (tableView == tableView1) {
           
    NSDictionary *tmpDict = [displayObject objectAtIndex:indexPath.row];
    
 
    NSMutableString *text;
    text = [NSString stringWithFormat:@"%@  %@"
            ,[tmpDict objectForKey:jobid]
            ,[tmpDict objectForKey:position]];
  
    NSMutableString *detail;
    detail = [NSString stringWithFormat:@"         %@ ,%@ ,%@"
              ,[tmpDict objectForKey:city]
              ,[tmpDict objectForKey:state]
              ,[tmpDict objectForKey:rate]];
    
    cell.textLabel.text = text;
    cell.detailTextLabel.text= detail;
    [cell.textLabel setFont:[UIFont fontWithName:@"Avenir Bold" size:14]];
    cell.detailTextLabel.textColor = [UIColor darkGrayColor];
    [cell.detailTextLabel setFont:[UIFont fontWithName:@"Avenir" size:15]];
    
   
    CGRect frameBtn = CGRectMake(320.0 - 32.0, 5.0, 28.0, 28.0);
   UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button addTarget:self
			   action:@selector(customActionPressed:) forControlEvents:UIControlEventTouchDown];
    cell.accessoryView = button;
    [button setImage:[UIImage imageNamed:@"submit_blue.png"] forState:UIControlStateNormal];
    [button setTitle:@"Hello" forState:UIControlStateNormal];
    [button setFrame:frameBtn];
    
        [cell addSubview:button];
    }
    else if(tableView == tableView2){
        NSDictionary *tmpDict = [displayObject objectAtIndex:indexPath.row];
        
   
        NSMutableString *text;
        text = [NSString stringWithFormat:@"%@ " 
                ,[tmpDict objectForKey:position]
               ];
        
        NSMutableString *detail;
        detail = [NSString stringWithFormat:@" %@ "
                  ,[tmpDict objectForKey:city]
                  ];
        
        cell.textLabel.text = text;
        cell.detailTextLabel.text= detail;
        [cell.textLabel setFont:[UIFont fontWithName:@"Avenir Bold" size:14]];
        cell.detailTextLabel.textColor = [UIColor darkGrayColor];
        [cell.detailTextLabel setFont:[UIFont fontWithName:@"Avenir" size:15]];
    }


   
        return cell;
    
    
}


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-09 12:21:50 By : vishwa
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : iOS - How to create more than one UITableView with cell action in single view controller.
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่