Closed MoathOthman closed 3 years ago
I'm facing this issue as well
I am getting same issue while showing UIContxtMenu, Have a look at the attached screenshot
Please help me
you need to refresh the view some home, can you share some code @mehroozkhan
@MoathOthman thank you so much for the response, how can I refresh UIContextMenu. My code is :
func tableView(_ tableView: UITableView, contextMenuConfigurationForRowAt indexPath: IndexPath, point: CGPoint) ->
UIContextMenuConfiguration? {
let contact = self.fetchUserListController.object(at: indexPath)
let index = indexPath.row
let identifier = "\(index)" as NSString
let info = UIAction(
title: L10n.contactInfo,
image: UIImage(systemName: "info.circle")) { _ in
self.userProfile(indexpath: indexPath)
}
let mute = UIAction(
title: L10n.mute,
image: UIImage(systemName: "speaker.slash")) { _ in
//self.showAlert("Error", message: "Implement mute action", handler: nil)
}
let delete = UIAction(
title: L10n.delete,
image: UIImage(systemName: "trash")) { _ in
}
let audioCall = UIAction(
title: L10n.audioCall,
image: UIImage(systemName: "phone")) { _ in
self.makeAudioVideoCall(audioCall: true, indexpath: indexPath)
}
let videoCall = UIAction(
title: L10n.videoCall,
image: UIImage(systemName: "video")) { _ in
self.makeAudioVideoCall(audioCall: false, indexpath: indexPath)
}
let leaveGroup = UIAction(
title: L10n.exitGroup,
image: UIImage(systemName: "person.3")) { _ in
self.makeAudioVideoCall(audioCall: false, indexpath: indexPath)
}
var menu = UIMenu()
if contact.isGroup {
menu = UIMenu(title: "", children: [info, mute, delete, leaveGroup])
} else {
menu = UIMenu(title: "", children: [info, mute, delete, audioCall, videoCall])
}
return UIContextMenuConfiguration(
identifier: identifier,
previewProvider: nil) { _ in
return menu
}
}
@available(iOS 13.0, *)
func tableView(_ tableView: UITableView, previewForHighlightingContextMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? {
return makeTargetedPreview(configuration)
}
@available(iOS 13.0, *)
func tableView(_ tableView: UITableView, previewForDismissingContextMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? {
return makeTargetedPreview(configuration)
}
@available(iOS 13.0, *)
func makeTargetedPreview(_ configuration: UIContextMenuConfiguration) -> UITargetedPreview? {
guard let identifier = configuration.identifier as? String, let index = Int(identifier) else {
return nil
}
if let cell = homeTblView.cellForRow(at: IndexPath(row: index, section: 0)) as? ChatTableViewCell {
return UITargetedPreview(view: cell.contentView)
}
return nil
}
@available(iOS 13.0, *)
func tableView(_ tableView: UITableView, willDisplayContextMenu configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionAnimating?) {
}
@available(iOS 13.0, *)
func tableView(_ tableView: UITableView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) {
}
@MoathOthman moreover when I view it in debug view hierarchy it looks okay,
please help me its been 2 days now, I am stuck here
@mehroozkhan can you create a small demo. i just tried context menu but not from the table view delegate and it was fine. but your case is a bit different
@MoathOthman you want me to create demo project or demo video ? I used the same code in another project and that's working fine,
For English language it works fine, getting this flipped issue only for arabic (RTL)
demo project would be great @mehroozkhan try to reloadData on viewDidAppear ,
@mehroozkhan did you find a way to resolve it?
@MoathOthman Not yet, actually, it's a big project, I don't know how to create a demo project out of it.
@mehroozkhan have you tried
self.tableView.semanticContentAttribute = .unspecified
@MoathOthman yes, did not work, I can't understand why it shows correctly in debug view hierarchy
@mehroozkhan any luck ?
@MoathOthman Yes, I fixed it, in xcode project my development language was set to arabic, I changed it to english, thats it.
@mehroozkhan you mean the app language from the project scheme ?!
@MoathOthman not app language, its development language, I don't know how it got set to arabic.
mm, but how do u do localization?
@MoathOthman I did not understand, No using localization in storyboard,
doing localization via code only.
I see, good to hear to worked out for you 👍
Flip Collection flow layout flow