9

मैं आईफोन पर स्थानीय ऑडियो फाइलों को चलाने के लिए एक ऐप बनाना चाहता हूं लेकिन मैं अपने कुछ कोडों से फंस गया हूं। मैं सोच रहा हूं कि आप एक दृश्य को कैसे दबा सकते हैं, uitableviewcontroller पर वापस आएं और किसी भी नई स्ट्रिंग को दबाए बिना दृश्य पर वापस आने के लिए एक बटन (जैसे "प्लेयर प्लेयर में" अभी खेलना "बटन) का उपयोग करें ..दृश्य को कैसे धक्का दें, वापस जाएं और दृश्य पर वापस आएं?

धन्यवाद आपको

मुझे अपने कोड से क्या बदलना चाहिए?

uitableviewcontroller में

..

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath 
    *)indexPath { 
selectedSong = [directoryContent objectAtIndex:indexPath.row]; 
NSString *storyLin = [[directoryContent objectAtIndex:[indexPath row]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 
patch = [NSString stringWithFormat:@"/%@", storyLin]; 


     myDetViewCont = [[mPlayerViewController alloc] initWithNibName:@"mPlayerViewController" bundle:nil];  
myDetViewCont.myProgLang = selectedSong; // assigning the correct value to the variable inside DetailViewController 
     [self.navigationController pushViewController:myDetViewCont animated:YES]; 
     [myDetViewCont release]; // releasing controller from the memory 

    } 

mPlayerViewController.m

-(IBAction) backtoplayer{ 
    myDetViewCont = [[mPlayerViewController alloc] initWithNibName:@"mPlayerViewController" bundle:nil]; 
} 

उत्तर

11

आप नेविगेशन नियंत्रक पर एक दृश्य के धक्का दिया है में, बस इसे नीचे दृश्य की समीक्षा करने के पॉप।

है, दृश्य आपको धक्का myDetViewCont सिर्फ backtoplayer कॉल में पॉपअप किया जाना चाहिए।

- (IBAction)backToPlayer:(id)sender { 
    [self.navigationController popViewControllerAnimated:YES]; 
} 
4

मार्क ने जो कहा, उसे जोड़ने के लिए।

एक बार जब आप popViewController एनीमेटेड हो जाते हैं और उपयोगकर्ता एक ही नियंत्रक को फिर से धक्का देना चाहता है, तो आपको इसे रिलीज़ करने के बजाय mPlayerViewController को रखने की आवश्यकता है।

जैसे:

if (!myDetViewCont) 
    { // We only need to create it once. 
      myDetViewCont = [[mPlayerViewController alloc] initWithNibName:@"mPlayerViewController" bundle:nil];  
    } 
    myDetViewCont.myProgLang = selectedSong; 
    [self.navigationController pushViewController:myDetViewCont animated:YES]; 
    // no longer release here, move the release call to the dealloc 
+0

अद्भुत !!!! आप दोनों दोस्तों को धन्यवाद! लेकिन जब मैं uitableviewController में किसी पंक्ति (गीत) पर क्लिक करता हूं तो हर बार एक नया mplayerViewController को कैसे बनाया जा सकता है? '(शून्य) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath { myDetViewCont = [[mPlayerViewController alloc] initWithNibName: @" mPlayerViewController "बंडल: शून्य]; ' – Alby

संबंधित मुद्दे