Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9246829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:35:04+00:00 2026-06-18T09:35:04+00:00

I am building an iOS app using Rubymotion. In this app I let the

  • 0

I am building an iOS app using Rubymotion. In this app I let the user “sign” their name by drawing on a view. I want to save this “signature” to a real image so that I can upload it to the server.

I think I have found an Objective-C solution here: iPhone : How to save a view as image ??? (ex.save what you draw )

The code for that looks like this:

UIGraphicsBeginImageContext(view.bounds.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

I have tried to “translate” this code into Ruby like this:

UIGraphicsBeginImageContext(signature.bounds.size)
signature.layer.renderInContext(UIGraphicsGetCurrentContext)
image = UIImage.UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()

But I get this error when running it:

uninitialized constant SignatureController::UIGraphicsGetCurrentContext (NameError)
2013-01-27 14:20:29.943 buy_app[18384:13d03] *** Terminating app due to uncaught exception 'NameError', reason: 'signature_controller.rb:88:in `save': uninitialized constant SignatureController::UIGraphicsGetCurrentContext (NameError)

What am I doing wrong? What is the best way of saving a normal view into an image?

Thanks!

UPDATE

I solved it like this:

UIGraphicsBeginImageContext(signature.bounds.size)
signature.layer.renderInContext(UIGraphicsGetCurrentContext())
image = UIImage.UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
image = UIImagePNGRepresentation(image)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:35:05+00:00Added an answer on June 18, 2026 at 9:35 am

    I solved it like this

    UIGraphicsBeginImageContext(signature.bounds.size)
    signature.layer.renderInContext(UIGraphicsGetCurrentContext())
    image = UIImage.UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()
    image = UIImagePNGRepresentation(image)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building an iOS app using Rubymotion and when I run the project
I am building an iOS app using Rubymotion. To be able to reuse code
I am building an iOS app using Rubymotion. I need to cache remote images
I'm building a view in my iOS app with Xcode. I'm using the interfice
I am building an iOS app using Rubymotion and I need to set the
I am building an iOS app using Rubymotion. I get data from a Rails
I'm building an IOS app using iCarousel ( http://cocoacontrols.com/platforms/ios/controls/icarousel ) I want to transform
I am building an iOS app using Rubymotion. I am using the build in
I am building a ios app for ipad, in which the user will be
I am building an app which uses cocos2D. I developed my app using iOS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.