我创建了一个包含UILongPressGestureRecognizer的自定义Label类,我在TableViewController中的tableview单元格中调用它.长按手势识别器工作(属性sting中的两个可点击区域),但如果滚动手势在我的CustomLabel的UILongPressGestureRecognizer区域之一开始,则包含标签的tableView不再滚动(平移).我已尝试过cancelsTouchesInView = false以下各种回复,但无济于事.任何建议将不胜感激.我花了一个星期来解决这个问题.我的代码如下.
这是CustomLabel类:
class CustomLabel: UILabel {
let layoutManager = NSLayoutManager()
let textContainer = NSTextContainer(size: CGSize.zero)
var textStorage = NSTextStorage() {
didSet {
textStorage.addLayoutManager(layoutManager)
}
}
var onCharacterTapped: ((_ label: UILabel, _ characterIndex: Int, _ state: Bool) -> Void)?
let tapGesture = UILongPressGestureRecognizer()
override var attributedText: NSAttributedString? {
didSet {
if let attributedText = attributedText {
if attributedText.string != textStorage.string {
textStorage = NSTextStorage(attributedString: attributedText)
DispatchQueue.main.async {
let characterDelay = TimeInterval(0.01 + Float(arc4random()) / Float(UInt32.max)) / 100 …Run Code Online (Sandbox Code Playgroud) 我正在尝试实现对用户电子邮件的验证(使用电子邮件模板中的默认验证 URL),以及 ActionCodeSetting URL(动态链接)以将用户带回应用程序。我对 Firebase 的 ActionCodeSetting 电子邮件验证应该如何工作感到困惑。我已阅读文档的每个可用页面,但我仍然不清楚如何正确配置“继续 URL”以不抢占和覆盖默认验证 URL。
我做了什么:
这是我已经实现的代码:
var actionCodeSettings = ActionCodeSettings.init()
actionCodeSettings.handleCodeInApp = true
let user = Auth.auth().currentUser
let urlString = "https://blaproject.page.link/zCB4"
actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)
actionCodeSettings.setAndroidPackageName("com.example.android", installIfNotAvailable:true, minimumVersion:"12")
Auth.auth().currentUser?.sendEmailVerification(with: actionCodeSettings, completion: { (error) in
print("verification email sent")
print("action code setting URL is: \(String(describing: actionCodeSettings.url))")
})
Run Code Online (Sandbox Code Playgroud)
以下是 Firebase 控制台中电子邮件模板的默认验证 URL:
https://blaproject-ea9d6.firebaseapp.com/__/auth/action?mode= &oobCode=
这是上面代码发送的验证 URL:
所以我的问题是,为什么此 URL 不验证用户的电子邮件,然后使用继续 URL(以及关联的域)来触发应用程序打开?它仅触发应用程序打开,而不验证用户的电子邮件。
感谢您提供的任何提示来帮助我理解我不理解的内容:)
email-verification firebase ios-universal-links firebase-dynamic-links
我需要SDWebImageManager的完成处理程序功能(以将下载或缓存的图像设置为黑白),因此我使用它而不是sd_setimage。我的问题是我不知道如何使用SDWebImageManager下载或获取图像的缓存版本。每次将tableview单元出队并重新加载时,图像都会重新下载。我尝试设置选项:SDWebImageDownloaderOptions.useNSURLCache,但无济于事。任何建议将不胜感激!这是我的代码:
SDWebImageManager.shared().imageDownloader?.downloadImage(with:URL(string: imgURL), options: SDWebImageDownloaderOptions.useNSURLCache, progress: nil, completed: { (image, error, cacheType, url) in
if image != nil {
let beginImage = CIImage(image: image!)
let blackNwhiteImg = beginImage?.applyingFilter("CIColorControls", withInputParameters: [kCIInputSaturationKey:0.0])
let newImage = UIImage(ciImage: blackNwhiteImg!)
cell.button.setImage(newImage, for: .normal)
}
})
Run Code Online (Sandbox Code Playgroud) 这似乎是一个基本问题,但在 Material UI 的官方文档中没有如何实现这一点的示例。
我尝试过嵌套网格,但右侧的网格元素不会跨越垂直空间。我尝试过align-items =“stretch”。
下面是屏幕截图和我的代码。感谢您的任何建议!
return (
<Container>
<Box>
<Typography>Test</Typography>
</Box>
<Grid container spacing={3} direction="row" justify="center" alignItems="stretch">
<Grid item xs={12}>
<Paper className={classes.paper}>xs=12</Paper>
</Grid>
<Grid item xs={6} spacing={3}>
<Grid>
<Card className={classes.root} variant="outlined">
<CardContent>
<Typography className={classes.title} color="textSecondary" gutterBottom>
Customer Profile
</Typography>
<Typography variant="h5" component="h2">
Sarah Doria
</Typography>
<Typography className={classes.pos} color="textSecondary">
Position
</Typography>
<Typography variant="body2" component="p">
Company
<br />
{'"a benevolent smile"'}
</Typography>
</CardContent>
<CardActions>
<Button size="small">Learn More</Button>
</CardActions>
</Card>
</Grid>
<Grid>
<Card className={classes.root} variant="outlined">
<CardContent>
<Typography className={classes.title} color="textSecondary" gutterBottom>
Preferences …Run Code Online (Sandbox Code Playgroud) ios ×2
swift ×2
caching ×1
firebase ×1
html ×1
javascript ×1
material-ui ×1
reactjs ×1
sdwebimage ×1
uilabel ×1