Giter Site home page Giter Site logo

Comments (19)

abdallahnh avatar abdallahnh commented on September 24, 2024

I'm facing this issue as well

from molh.

mehroozkhan avatar mehroozkhan commented on September 24, 2024

I am getting same issue while showing UIContxtMenu, Have a look at the attached screenshot

Simulator Screen Shot - iPhone 11 - 2020-10-21 at 19 44 44

Please help me

from molh.

MoathOthman avatar MoathOthman commented on September 24, 2024

you need to refresh the view some home, can you share some code @mehroozkhan

from molh.

mehroozkhan avatar mehroozkhan commented on September 24, 2024

@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) {
    
}

from molh.

mehroozkhan avatar mehroozkhan commented on September 24, 2024

@MoathOthman moreover when I view it in debug view hierarchy it looks okay,

Screenshot 2020-10-21 at 7 51 48 PM

please help me its been 2 days now, I am stuck here

from molh.

MoathOthman avatar MoathOthman commented on September 24, 2024

@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

from molh.

mehroozkhan avatar mehroozkhan commented on September 24, 2024

@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)

from molh.

MoathOthman avatar MoathOthman commented on September 24, 2024

demo project would be great
@mehroozkhan try to reloadData on viewDidAppear ,

from molh.

MoathOthman avatar MoathOthman commented on September 24, 2024

@mehroozkhan did you find a way to resolve it?

from molh.

mehroozkhan avatar mehroozkhan commented on September 24, 2024

@MoathOthman Not yet,
actually, it's a big project, I don't know how to create a demo project out of it.

from molh.

MoathOthman avatar MoathOthman commented on September 24, 2024

@mehroozkhan have you tried
self.tableView.semanticContentAttribute = .unspecified

from molh.

mehroozkhan avatar mehroozkhan commented on September 24, 2024

@MoathOthman yes, did not work,
I can't understand why it shows correctly in debug view hierarchy

Screenshot 2020-10-24 at 4 02 35 PM

from molh.

MoathOthman avatar MoathOthman commented on September 24, 2024

@mehroozkhan any luck ?

from molh.

mehroozkhan avatar mehroozkhan commented on September 24, 2024

@MoathOthman Yes, I fixed it, in xcode project my development language was set to arabic,
I changed it to english, thats it.

from molh.

MoathOthman avatar MoathOthman commented on September 24, 2024

@mehroozkhan you mean the app language from the project scheme ?!
Screen Shot 2020-11-12 at 3 23 03 PM

from molh.

mehroozkhan avatar mehroozkhan commented on September 24, 2024

@MoathOthman not app language, its development language, I don't know how it got set to arabic.

Screen Shot 2020-11-12 at 5 26 23 PM

from molh.

MoathOthman avatar MoathOthman commented on September 24, 2024

mm, but how do u do localization?

from molh.

mehroozkhan avatar mehroozkhan commented on September 24, 2024

@MoathOthman I did not understand, No using localization in storyboard,

doing localization via code only.

from molh.

MoathOthman avatar MoathOthman commented on September 24, 2024

I see, good to hear to worked out for you πŸ‘

from molh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.