2013-05-31 32 views
0
- (void)viewDidLoad 
    { 
    [super viewDidLoad]; 

    [self.segmentedControl removeAllSegments]; 
    s = 0; 
    for (NSDictionary *dictionary in self.top.segments) { 
     [_segmentedControl insertSegmentWithTitle:dictionary [@"sTitle"] atIndex:s animated:NO]; 
     self.bioTextView.text = [NSString stringWithFormat:@"%@", dictionary [@"sData"]]; 
    }} 

我的segmentedControl以相反的顺序开始。如果有人知道,请告诉我如何解决这个问题? 请参阅视频中的示例: http://youtu.be/YSYFxvb7fpA为什么SegmentedControl以相反顺序打开?

+0

谢谢你,但没有改变 – Astakhoff

回答

1

您在索引0处始终添加了新段,即在开始处。

所以你得到这样的:

A 

B>A 

C>B>A 

您需要在末尾添加。

用途:

s = 0; 
for (NSDictionary *dictionary in self.top.segments) { 
    [_segmentedControl insertSegmentWithTitle:dictionary [@"sTitle"] atIndex:s animated:NO]; 
    self.bioTextView.text = [NSString stringWithFormat:@"%@", dictionary [@"sData"]]; 
    s++; 
} 
+0

太谢谢你了! – Astakhoff

+1

@Astakhoff:这工作? –

+0

只是工作!谢谢。 – Astakhoff