2009-11-27 8 views

उत्तर

6

आपको एनएसटीमर का उपयोग करके इसे स्वयं लागू करना होगा। आप आगे से एक को लेकर और पीछे की ओर जोड़कर अपने textLabel.text के पात्रों को चक्र में घुमाएंगे। आदेश में इस आसानी से आप एक NSMutableString कि आप substringWithRange:deleteCharactersInRange: और appendString, और उसके बाद हर किरदार में गड़बड़ी के बाद textLabel.text के रूप में सेट का उपयोग कर हेरफेर होगा इस्तेमाल कर सकते हैं करने के लिए:

- (void)fireTimer 
{ 
    NSMutableString *mutableText = [NSMutableString stringWithString: textLabel.text]; 
    //Takes the first character and saves it into a string 
    NSString *firstCharText = [mutableText substringWithRange: NSMakeRange(0, 1)]; 
    //Removes the first character 
    [mutableText deleteCharactersInRange: NSMakeRange(0, 1)]; 
    //Adds the first character string to the initial string 
    [mutableText appendString: firstCharText]; 

    textLabel.text = mutableText; 
} 
+0

एक आदर्श जवाब यही –

+0

संकेत के लिए धन्यवाद। एक आकर्षक की तरह काम किया। – versatilemind

+0

बहुत चिकनी नहीं है, लेकिन परिणाम बनाम कोड की रेखाएं बिल्कुल सही है! – JOM

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