1

I have a demo where I need to prove that images can be copied and pasted inside an iPhone simulator.

What apps, or which types of elements can be used which will allow me to paste a copied image in the simulator.

Note, I know how to copy images in the simulator, I just don't have SMS or Whatsapp to paste them into as I would on an iPhone.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Jack Robson
  • 2,184
  • 4
  • 27
  • 50

2 Answers2

0

You can create simple application with a UIImageView inside the ViewController and just override the paste function of the UIViewController. In my case, I added a tap gesture to my UIImageView to display the context menu. And when the paste function is called, I get the copied image from the UIPasteBoard.

class ViewController : UIViewController
{
  @IBOutlet weak var imgView : UIImageView!

  override func viewDidLoad()
  {
    super.viewDidLoad()

    imgView.addGestureRecognizer(UITapGestureRecognizer(target: self,action:#selector(HomeViewController.showContextMenu(_:))))
  }

  override func paste(sender: AnyObject?)
  {
    imgView.image = UIPasteboard.generalPasteboard().image
  }


  override func canBecomeFirstResponder() -> Bool 
  {
    return true
  }

  func showContextMenu(gesture: UITapGestureRecognizer)
  {
    if let sender = gesture.view
    {
      let menu = UIMenuController.sharedMenuController()
      menu.setTargetRect(sender.frame, inView: self.view)
      menu.setMenuVisible(true, animated: true)
      becomeFirstResponder()
    }
  }
}
Christian Abella
  • 5,747
  • 2
  • 30
  • 42
0

You can use the Files app. Open it, go Browse -> On My iPhone, then long press (click) the blank area to summon the pasteboard menu.

Files App

Ric Santos
  • 15,419
  • 6
  • 50
  • 75
  • can you help me with this https://stackoverflow.com/questions/39674809/mwphotobrowser-crash-while-i-have-too-many-images-and-swipe-too-fast – ArgaPK Feb 22 '22 at 10:56