答案 0 :(得分:1)
import UIKit
class CustomTableViewCell: UITableViewCell {
//Cell View Object
let imgUser = UIImageView()
let lblTitle = UILabel()
let lblDescription = UILabel()
//constant
let paddingWithContent:CGFloat = 20.0
let gapBetweenObject:CGFloat = 10.0
let heightWidthImage:CGFloat = 40.0
let heightTitle:CGFloat = 25.0
//Init
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
//cell object property
imgUser.backgroundColor = .blue
imgUser.contentMode = .scaleAspectFill
lblDescription.numberOfLines = 0
lblTitle.adjustsFontSizeToFitWidth = true
lblTitle.minimumScaleFactor = 0.7
//translatesAutoresizingMas
imgUser.translatesAutoresizingMaskIntoConstraints = false
lblTitle.translatesAutoresizingMaskIntoConstraints = false
lblDescription.translatesAutoresizingMaskIntoConstraints = false
//add to cell
contentView.addSubview(imgUser)
contentView.addSubview(lblTitle)
contentView.addSubview(lblDescription)
//add constraint
NSLayoutConstraint.activate([
//img
imgUser.topAnchor.constraint(equalTo: contentView.topAnchor, constant: paddingWithContent),
imgUser.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: paddingWithContent),
imgUser.widthAnchor.constraint(equalToConstant: heightWidthImage),
imgUser.heightAnchor.constraint(equalToConstant: heightWidthImage),
//title lable
lblTitle.topAnchor.constraint(equalTo: contentView.topAnchor, constant: paddingWithContent),
lblTitle.leadingAnchor.constraint(equalTo: imgUser.leadingAnchor, constant: heightWidthImage + gapBetweenObject),
lblTitle.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -paddingWithContent),
lblTitle.heightAnchor.constraint(equalToConstant: heightTitle),
//description label
lblDescription.topAnchor.constraint(equalTo: lblTitle.bottomAnchor, constant: gapBetweenObject),
lblDescription.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -paddingWithContent),
lblDescription.leadingAnchor.constraint(equalTo: imgUser.leadingAnchor, constant: heightWidthImage + gapBetweenObject),
lblDescription.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -paddingWithContent),
])
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
}
//布局
class Current extends \Magento\Framework\View\Element\Html\Link\Current //block
{
/**
* @return string
*/
public function toHtml()
{
if (SOME CONDITION HERE) {
return parent::toHtml(); //show link
}
return ''; //hide link
}
答案 1 :(得分:0)
步骤1: 首先,您需要在以下主题中创建一个customer_account.xml:
public ApiGatewayResponse handleRequest(final Map<String, Object> request, final Context context) {
final Map<String, Object> requestContext = (Map<String, Object>) request.get("requestContext");
final Map<String, Object> identity = (Map<String, Object>) requestContext.get("identity");
final String userId = (String) identity.get("cognitoIdentityId");
// etc
}
第2步:添加删除文件链接:
为了简化和简化故事,在下面的示例中,我将立即向您展示如何从导航中一个接一个地删除所有链接。
app/design/frontend/_YOUR_VENDOR_/_YOUR_THEME_/Magento_Customer/layout/customer_account.xml
请在https://inchoo.net/magento-2/managing-my-account-navigation-links-magento-2/
中查看更多详细信息