2016-12-12 1 views
5

다음 코드로 LiduidFloatingActionButton에 두 개의 단추 셀을 만들었습니다.함수에서 LiquidFloatingActionButton의 인덱스 셀에 액션을 추가하는 방법은 무엇입니까?

private func createFloatingButtons(){ 
    cells.append(createButtonCell("firstCell")) 
    cells.append(createButtonCell("secondCell")) 
    let floatingFrame = CGRect(x: self.view.frame.width - 56 - 16, y: self.view.frame.height - 56 - 36, width: 56, height: 56) 
    let floatingButton = createButton(floatingFrame, style:.Up) 
    self.view.addSubview(floatingButton) 
    self.floatingActionButton = floatingButton 
} 

LiquidFloatingActionButton의 각 셀에 동작을 추가하고 셀 이름을 표시할지 모르겠다. 아무도 그것에 대해 알지 못하면 저를 도우십시오.

+0

Vadadoriya 당신은 내가 createButtonCell FUNC 개인 기능을 다음과 같은 코드를 추가 할 필요가 의미 @jignesh createButtonCell –

+0

의 코드 추가 (iconName : 문자열) -> LiquidFloatingCell { 수 있도록 이름 = LiquidFloatingCell (아이콘 :있는 UIImage (이름 : iconName) !) 반환 이름 } –

답변

2

각 셀에 조치를 추가하는 방법이 있습니다.

extension CampaignListViewController: LiquidFloatingActionButtonDelegate { 
func liquidFloatingActionButton(liquidFloatingActionButton: LiquidFloatingActionButton, didSelectItemAtIndex index: Int){ 
    // floatingActionButton.didTappedCell() 
    switch(index){ 
    case 0: 
     // do something 
     break; 

    case 1: 
     // do somthing 
     break; 

    default: 
     break; 
    } 

    self.floatingActionButton.close() 
} 
관련 문제