ios - How to detect ellipsis in a UILabel? -


मैं Objective C पर प्रोग्रामिंग कर रहा हूँ। मेरे पास UITableView के साथ UILabel 's है UILabel में एलीपिसिस कैसे पता लगा सकता है?

पहले हम पाठ की चौड़ाई प्राप्त कर सकते हैं जो लेबल में प्रदान किया जाएगा। फिर हम उस चौड़ाई को लेबल की चौड़ाई से तुलना कर सकते हैं। यदि उस चौड़ाई से अधिक हो तो स्ट्रिंग को अन्यथा छोटा नहीं किया जाता है।

UPDATE

यदि पंक्तियां होती हैं तो लाइनों की संख्या गिनती है और lablewidth * numofLines < / P> <पूर्व> UILabel * lblAppTitle = (UILabel *) [self.view viewWithTag: 777]; CGSize stringSize = [lblAppTitle.text sizeWithFont: lblAppTitle.font]; // गणना पंक्तियों की संख्या [lblAppTitle sizeToFit]; इंट न्यूलाइंस = (इंट) (lblAppTitle.frame.size.height / lblAppTitle.font.leading); यदि (stringSize.width & gt; (lblAppTitle.frame.size.width) * numlines) एनएसएलॉग (@ "कटौती हुई स्ट्रिंग"); अन्य NSLog (@ "स्ट्रिंग को कम नहीं किया");

आशा है कि यह आपकी सहायता करता है।

Comments

Popular posts from this blog

php - How to filter values fetched from database on the basic of comma included? -

c# - Add Image in a stackpanel based on textbox input -

excel vba - How to delete Solver(SOLVER.XLAM) code -