मैंने UILabel
के दो उदाहरण बनाए और उन्हें अपने ViewController
के दृश्य में जोड़ा। और फिर मैंने 0.5 से 1.0 (x और y) से प्रत्येक के anchorPoint
को बदल दिया।जब मैं अपने एंकरपॉइंट को बदलने के बाद अपना फ्रेम सेट करता हूं तो मेरा दृश्य क्यों चलता है?
अगला, मैंने uiLabel2
के फ्रेम को अपने फ्रेम में रीसेट कर दिया है, मैंने इसे बनाया है: (100,100,100,20)।
जब मैं ऐप चलाता हूं, uiLabel1
और uiLabel2
विभिन्न स्थितियों पर दिखाता है। क्यूं कर?
UILabel *uiLabel1 = [[[UILabel alloc] initWithFrame:CGRectMake(100, 100, 100, 20)] autorelease];
uiLabel1.text = @"UILabel1";
uiLabel1.layer.anchorPoint = CGPointMake(1, 1);
UILabel *uiLabel2 = [[[UILabel alloc] initWithFrame:CGRectMake(100, 100, 100, 20)] autorelease];
uiLabel2.text = @"UILabel2";
uiLabel2.layer.anchorPoint = CGPointMake(1, 1);
uiLabel2.frame = CGRectMake(100, 100, 100, 20);
[self.view addSubview:uiLabel1];
[self.view addSubview:uiLabel2];
अपडेट किया गया ओह! लूट! आपके महान और विस्तृत उत्तर के लिए धन्यवाद। –