0
私は、次のコードを持っている:カスタムラベルを完全
if (product) {
if ([product.title isStringOfInterest]) {
scriptName = [[PPLinearLayoutLabelItem alloc] initWithText:@"" font:[PPFonts bold20] maxWidth:[LayoutValues getMaxWidthClipped]];
[self.topContainerContent addObject:scriptName];
extraName = [[PPLinearLayoutLabelItem alloc] initWithText:@"" font:[PPFonts regular14] maxWidth:[LayoutValues getMaxWidthClipped]];
[scriptName setPaddingTop:20];
[self.topContainerContent addObject:extraName];
}
}
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(void){
[self loadProductDetails];
});
-(void) loadProductDetails{
IHProduct *product = orderDisplayed.product;
id<ProductDownloadServiceProtocol> productDetailsDownloader = [[ProductDownloadService alloc] initWithClient:[[HttpClient alloc] initWith:APIbackend forEndpoint:EndpointProduct]];
[productDetailsDownloader downloadProductWithProductID:product.productID success:^(ProductDownloadResponse *response) {
scriptName.label.text = [NSString stringWithFormat:@"%@ (%@)",response.product.title,response.product.pillTypeShort];
extraName.label.text = response.product.sameAs;
NSString *qtyText = [NSString stringWithFormat:@"%@ PACKS (%@ at $%@ per pack)",[orderDisplayed.interval objectForKey:@"quantity_per_interval"], [orderDisplayed.interval objectForKey:@"quantity_per_interval"], response.product.price];
quantity.label.text = qtyText;
} error:^(ProductDownloadResponse *response) {
[self hideHttpLoadingOverlay];
[RMUniversalAlert showAlertInViewController:self
withTitle:alertErrorTitle
message:@"Error downloading mail order product details"
cancelButtonTitle:OKDialogButton
destructiveButtonTitle:nil
otherButtonTitles:nil
tapBlock:nil];
}];
}
ラベルextraname
とscriptname
は、すなわち、不完全なデータを埋めなっているか、最後に切り落とさばかり。これをどうすれば解決できますか?私が静的に大きなテキストを置くとき、データはそれらのビューにうまく埋められます。助けて!
self.label.numberOfLinesが、私は私のloadproductdetails内からすなわちディスパッチスレッドこのすべてを行うことはできますかように、あなたが最初に提案するように私は私のラベルを設定する必要がない場合にのみ動作しますapiコールは後でそれをデータで埋めますか? – Ackman
PS rectOfTextとは何ですか? fontAttributes? – Ackman
私はコードを修正しました!今すぐloadproductdetailsに追加してください(テスト目的)! @Ackman –