uilabel

How to change the label text in UIScrollview for each page Different text?

…衆ロ難τιáo~ 提交于 2019-12-24 06:44:55
问题 Hi in my app i want to show label text different at each image in UIScrollView. Here is my code. for (int i=0; i<imageArray.count; i++) { NSString *str = [imageArray objectAtIndex:i]; NSString *bannerImageURL = [NSString stringWithFormat:@"http://url.com", str]; CGFloat myOrigin = i * self.view.frame.size.width; UIImageView *myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(myOrigin, 0, self.view.frame.size.width,imgScrollView.frame.size.height)]; myImageView.contentMode =

Showing asian unicode string in UILabel

你说的曾经没有我的故事 提交于 2019-12-24 06:20:26
问题 How can we show asian unicode values in UILabel \U2013\U00ee\U2013\U00e6\U2013\U2202\U2013\U220f\U2013\U03c0 \U2013\U00ee\U2013\U220f\U2013\U03c0\U2013\U00aa\U2013\U221e\U2014\U00c5 Thanks 回答1: I'm not sure what is particularly “Asian” about that text, U+2013 is an en-dash (–) U+00ee is a lowercase ‘i’ with a circumflex (î) U+00e6 is the old ligature for ae (æ) U+2202 is the character for a partial differential (∂). If your program is being localised [that is to say that the program will be

How to make a custom view's frame match its instrinsic content size

本小妞迷上赌 提交于 2019-12-24 01:47:05
问题 Custom Label that Resizes According to its Contents I'm making a label from scratch. (My end purpose is to make a vertical text label for Mongolian script, but for now I am just making a normal horizontal text label as practice.) As long as there are no length and width constraints, I want my custom label's frame to resize according to its intrinsic content size. It Works in IB In IB everything seems to be working fine when I test a UILabel , my custom label (a UIView subclass), and a button.

UIPicker font size for a certain column and row

好久不见. 提交于 2019-12-24 00:59:47
问题 I'm looking to change the font size of a certain column and row in a UIPicker. Basically there's too much text that runs off the view and I'd like to size just that particular row in the 2nd column down so it fits? thanks for any help. 回答1: If you want to customize label font size, implement delegate method called : -(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view; to return a well configured UILabel (you

Swift iOS. Multi line UILabel background color to follow the text

旧街凉风 提交于 2019-12-24 00:59:22
问题 I have a multi line UILabel which I want to set the background color exactly the same as when you highlight the text on a web browser with your mouse but cannot seem to find a solution. This is what I got in my storyboard: And this is what I am aiming to achieve: This is the browser example I was mentioned above: 回答1: Yes, use attribute text. Here for swift let textBgColor = UIColor.greenColor() let attributes = [ NSBackgroundColorAttributeName : textBgColor ] let attributedString =

UILabel inside nested UIStackViews inside UITableViewCell sometimes truncating

天涯浪子 提交于 2019-12-24 00:59:12
问题 I have a tableview cell in one of my tables setup as containing the following view hierarchy The outer horizontal stackview is pinned to the cell's content view on trailing, leading, bottom and top edges. The right label is pinned to its parent stackViewHackView on trailing, leading, bottom and top edges Within my controllers code I've got the cells setup to be dynamic height to fit the content of the cells so they can grow or shrink depending on the content size tableView.rowHeight =

UILabel extra spaces before and after text ios

為{幸葍}努か 提交于 2019-12-24 00:46:48
问题 Label shows text perfectly in portrait mode. It also works properly when device rotates from portrait to landscape or landscape to portrait. But when i open app in landscape mode it shows extra spaces before and after the text. I have used NumberOfLines = 0 and sizeToFit . and also tried CGSize aSize = [self.label sizeThatFits:CGSizeMake(self.label.frame.size.width, CGFLOAT_MAX)]; self.label.frame = CGRectMake(self.label.frame.origin.x, self.label.frame.origin.y, self.label.frame.size.width,

XCode 9: Cannot convert value of type '[String : Any]' to expected argument type '[NSAttributedStringKey : Any]?'

丶灬走出姿态 提交于 2019-12-24 00:37:28
问题 I have a custom class of UIOutlineLabel which draws an outline around the text within a label. Since updating to Swift 4 I get the following error: Cannot convert value of type '[String : Any]' to expected argument type '[NSAttributedStringKey : Any]?'. I have tried changing the strokeTextAttributes to: as! [NSAttributedStringKey : Any] but this results in a runtime error. There are also the Swift Language runtime warnings of 'UIOutlineLabel setOutlineWidth is deprecated and will be removed

iPhone Problem with custom cell

这一生的挚爱 提交于 2019-12-24 00:06:01
问题 I try this code but it's a mistake because i have a repetition of title and description... Someone can help me please? - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; CustomCell *cell=(CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell==nil){ cell=[[[CustomCell alloc]initWithFrame:CGRectZero reuseIdentifier:CellIdentifier]autorelease]; cell.accessoryType =

Adjust UILabel Dynamically Within UITableViewCell?

拟墨画扇 提交于 2019-12-23 22:12:24
问题 I would like to adjust the number of lines in a UILabel dynamically. For example, there could be a long string or a short string. If there are less than 10 characters, there should be one line. If there are 10-20 characters, it should be two lines. This UILabel is inside of a UITableViewCell. Currently, if there is a long string, then the UILabel just shows "..." wherever it runs out of space, so the string is cut off. How can I prevent this from happening? 回答1: Try: nameOfLabel.numberOfLines