2014-03-19 38 views
0

我嘗試處理2點擊UISegmentControl而沒有成功。 我向我的聽衆添加了一個目標UIControlEventValueChanged,它的工作原理是,但只有在未選中該段的情況下。UISegmentControl的處理程序攻絲通過ASC和DESC訂購數據

那我的函數柄敲擊,目標與故事板製作:

- (IBAction)changeFilterAction:(UISegmentedControl *)paramSender { 
    NSInteger selectedIndex = [_segmentControlFilter selectedSegmentIndex]; 
    NSLog(@"Test"); 
} 

要恢復:

我試圖通過ASC和DESC來排序依據的數據。當我第一次點擊我發佈ASC請求時,我希望在第二次發佈DESC請求時點擊它。

任何幫助,將不勝感激:)

+0

你可以發佈你的代碼嗎?不完全確定你想從你的問題中獲得什麼。 – Tim

+0

我添加了,但我不認爲它會有用 – Armanoide

+0

你在做什麼?檢測哪個段被選中?處理來自識別器的雙擊? – Tim

回答

0

我想通過檢查選項Momentary。謝謝

enter image description here

0

你會嘗試用鮮明的色彩添加自定義UIButton,並將它放置到UISegmentControl

例如:

UIButton * overButton = [[UIButton alloc] initWithFrame:CGRectMake(0.0, 0.0, segControl.frame.size.width/numOfSegments, segControl.frame.size.height)]; 

[overButton addTarget:segControl action:@selector(overTapped:) forControlEvents:UIControlEventTouchUpInside];    

[segControl addSubview:overButton]; 

//Adjust your `overButton` frame as per your selected Segment index 

謝謝!