2014-02-14 2 views
0

내 ParseXML 메서드는 NSNumber 값을 읽습니다.이 값은 버튼 클릭만으로 증가 할 수 있습니다.내보기가 업데이트되지 않습니다.

내 ParseXML 방법은 각각 8 일부터 30

아이디어는 내가 1 ~ 2에서의 NSNumber를 증가하는 경우, 내보기를 새로 고쳐 일치하는 8 개체를 잡고 있다는 것입니다에 ID가 240 개체가 ID를 찾아서 내보기에 표시합니다.

정확히 그렇게하지 않는 것입니다.

.h 

@interface FixturesController : UITableViewController 
{ 
    NSMutableData *_responseDataFixtures; 
    int goUp; 
    NSNumber *test; 
} 

@property (nonatomic, retain) NSArray *tableDataFixtures; 
@property (nonatomic, strong) NSMutableArray *roundParser; 
@property (nonatomic, strong) NSString *seasonRoundString; 
@property (nonatomic, strong) NSNumber *seasonRoundNumber; 

- (IBAction)goUpByOne:(UIButton *)sender; 

-(void) parseXMLFixtures:(NSNumber *) giveME; 



@end 


.m 


- (void) viewWillAppear:(BOOL)animated{ 
    [super viewWillAppear:animated]; 
    [self parseXMLFixtures:@2]; 
} 


- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    goUp = 1; 
    test = [NSNumber numberWithInt:goUp]; 

} 

// this allows me to increment the count of NSNumber. 
- (IBAction)goUpByOne:(UIButton *)sender { 

    goUp++; 

    test = [NSNumber numberWithInt:goUp]; 

    goUp = [test intValue]; 

} 


-(void) parseXMLFixtures:(NSNumber *) giveME 
{ 

    giveME = test; 

    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"There's no going back"]]; 

    NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; 

    NSString *xmlString = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]; 

    NSDictionary *xml = [NSDictionary dictionaryWithXMLString:xmlString]; 

    NSMutableArray *items = [xml objectForKey:@"Match"]; 

    NSMutableArray *newFixtureObjectArray = [[NSMutableArray alloc] init]; 

    NSNull *nullValue = [NSNull null]; 

    [newFixtureObjectArray insertObject:nullValue atIndex:0]; 
    [newFixtureObjectArray insertObject:nullValue atIndex:1]; 

    for (NSDictionary *dict in items) { 
     FixturesObject *myFixtures = [FixturesObject fixtureFromXMLDictionary:dict]; 
     [newFixtureObjectArray addObject:myFixtures]; 
    } 

    /////// 

    _seasonRoundString = [NSString stringWithFormat:@"%d", [giveME intValue]]; 
    _roundParser = [[NSMutableArray alloc]init]; 

    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"round == %@", _seasonRoundString]; 
    NSArray *filteredArray = [newFixtureObjectArray filteredArrayUsingPredicate:predicate]; 
    _roundParser = [NSMutableArray arrayWithArray:filteredArray]; 
    [_roundParser insertObject:nullValue atIndex:0]; 

    NSLog(@" Objects of Fixtures in my array %@", _roundParser); 

    ///// 

    [self setTableDataFixtures:_roundParser]; 
} 

의견이 있으십니까? 고맙습니다. 난 정말 일할 필요가 그래서 내가 자러 갈 수

+0

따를 수 있는가? – Lexicon

답변

0

아직 UITableViewDelegate, UITableViewDataSource 메서드를 구현 했습니까?

방법 :

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ } 

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { } 

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{} 

당신이 당신이`viewDidAppear` 대신`viewWillAppear`의 시도 했 tutorial

관련 문제