SORU
14 Temmuz 2011, PERŞEMBE


Ne kadar kapsayıcı bir görünüm için bir UİSegmentedControl programlı olarak Ekle

Nasıl UISegmentedControl için bir çerçeve tanımlar ki? Parçalı kontrolü container view ben alt kısmında görünmesini istiyorum.e 4**.

CEVAP
14 Temmuz 2011, PERŞEMBE


bu bir test ettim mükemmel.....

UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 435)];
 scroll.contentSize = CGSizeMake(320, 700);
 scroll.showsHorizontalScrollIndicator = YES;

 NSArray *itemArray = [NSArray arrayWithObjects: @"One", @"Two", @"Three", nil];
 UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:itemArray];
 segmentedControl.frame = CGRectMake(35, 200, 250, 50);
 segmentedControl.segmentedControlStyle = UISegmentedControlStylePlain;
 [segmentedControl addTarget:self action:@selector(MySegmentControlAction:) forControlEvents: UIControlEventValueChanged];
 segmentedControl.selectedSegmentIndex = 1;     
 [scroll addSubview:segmentedControl];
 [segmentedControl release]; 
 [self.view addSubview:scroll];

Ekle sınıfında yöntemi.

- (void)MySegmentControlAction:(UISegmentedControl *)segment 
{    
        if(segment.selectedSegmentIndex == 0)
        {
            // code for the first button
        } 
}

İtiraz UİSegmentedControlStyle *7 bir göz*atabilirsiniz URL.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • BlackmillMusic

    BlackmillMus

    3 Kasım 2010
  • MndsgnVEVO

    MndsgnVEVO

    26 Kasım 2013
  • TheJoeycool2010

    TheJoeycool2

    12 Temmuz 2010