Draw beautiful diagram effortlessly on ipad. Click here to know more..

Wednesday, March 28, 2012

Making the iOS text field/view visible which is located under keyboard

The text view being hidden by keyboard is a very common issue faced by iPhone/iPad developers. When you touch a text view, the text view becomes first responder and keyboard automatically appears. If the text view is lying somewhere in lower part of the screen, most probably it will get hidden under the keyboard. The solution is to scroll the text view up enough so that it comes above the keyboard. To do that, you need to add the text view in UIScrollView so that it can be scrolled up.
Here is the strategy:
  • Whenever keyboard appear, check if it is hiding the text view or not.
  • If it is hiding the text view, then scroll the text view up so that it becomes visible.
  • When the keyboard disappears, then scroll the text view to its original position.
Here is the sample code (similar code used in Lekh Diagram):

First register for the keyboard appearing/disappearing event:
[[NSNotificationCenter defaultCenter] addObserver:self
            name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
            name:UIKeyboardWillHideNotification object:nil];
The handler for the keyboard appearing event:
- (void)keyboardWasShown:(NSNotification*)aNotification {
    NSDictionary* info = [aNotification userInfo];
    CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;

    // get the keyboard height
    double keyboardHeight = kbSize.height;
    UIInterfaceOrientation currentOrientation = [[UIApplication sharedApplication] statusBarOrientation];
    // The calculations are little different for landscape mode.
    if (UIInterfaceOrientationLandscapeLeft == currentOrientation ||UIInterfaceOrientationLandscapeRight == currentOrientation ) {
        keyboardHeight = kbSize.width;
    // save the position of the scroll view, so that we can scroll it to its original position when keyboard disappears.
    originalScrollOffset = scroller.contentOffset;

    CGPoint cp = [editView convertPoint:editView.bounds.origin toView:[UIApplicationsharedApplication].keyWindow.rootViewController.view];
    cp.y += editView.frame.size.height;
    CGRect bounds = [[UIScreen mainScreen] applicationFrame];
    double sh = bounds.size.height;
    UIInterfaceOrientation currentOrientation = [[UIApplication sharedApplication] statusBarOrientation];
    if (UIInterfaceOrientationLandscapeLeft == currentOrientation ||UIInterfaceOrientationLandscapeRight == currentOrientation ) {
        sh = bounds.size.width;

    // scroll if the keyboard is hiding the text view
    if(cp.y > sh - keyboardHeight){
        double sofset = cp.y - (sh - keyboardHeight);
        CGPoint offset = scroller.contentOffset;
        offset.y += sofset;
        scroller.contentOffset = offset;

And when the keyboard disappears:
- (void)keyboardWillBeHidden:(NSNotification*)aNotification
    // restore the scroll position
    scroller.contentOffset = originalScrollOffset;

The above code is used in "Lekh Diagram" ipad app. Lekh Diagrma is a sketch recognition diagramming app.
You can get the Lekh Diagram from app store:

You can see how content in scrolled when the keyboard appears in the demo of Lekh Diagram:

Learn more about Lekh Diagram: http://www.avabodh.com/lekh


  1. Note for googlers: visit the link below

    1. Forming a wonderful art and including a case in your drawing surface with the Mixtiles promo code frame. Drawing your bright environment and showing the skills as an artist. The designer or artist is a unique person that is different from others.

  2. Good post. Speaking about technologies these days. All of the paperwork is left behind and now it is time to go virtual. Read about data room m&a and it will make sense to you.

  3. In my opinion, such researches will help you in the future. You can answer your children when they ask about family, etc. More over, you can help them with doing homework using https://domyhomework.guru/blog/make-homework-fun

  4. This some way or another is turning obliterating as a great part of the street conflicts are happening because of the utilization of TWD. To illuminate this inconvenience, versatile organizations are concocting Audio text message include which is making it advantageous to connect while driving even while texting.program that reads text

  5. Often this was met with slightly blank expressions - and rightly so as not many translation service providers would lay claim to offering poor quality translations. Technical Translation service

  6. Not a lot of businesses are aware of how powerful Bulk Texting is as a communication tool. When compared to emails, calls and other marketing channels, it is far superior due to its direct reach, response rates and cost which are three major check points every business is aiming for.

  7. This is colossally and superfluously tedious. You ought to most likely respite and begin again effectively, anytime in the record, and whenever, effortlessly. text to speech recorder

  8. خدمات تشمل جميع أركان تنظيف المنزل للحمامات والمطابخ تنظيف السجاد والأريكة بالإضافة إلى تنظيف وتطهير البلاط والأرضيات شركة النجوم لخدمات التنظيف
    شركة تنظيف فلل بجدة
    شركة تنظيف بيوت بجدة
    شركة تنظيف شقق بجدة

  9. Sounds interesting enough; maybe I'll watch out for this. with free guilds and quests

  10. https://hmzapc.com/fl-studio-cracked-download-here/
    FL Studio Crack is exclusive software. The software is used for Latest Music Creations. Its previous name is Fruity-loops. It’s a full product atmosphere or Latest Music Creations (LMC). Serving more further than 18 years of latest built. That provides everything.

  11. https://cracksoon.com/mcafee-antivirus-crack-key-full-download/
    Cracked Here is a useful place where you can easily find Activators, Patch, Full version software Free Download, License key, serial key, keygen, Activation Key and Torrents. Get all of these by easily just on a single click.

  12. https://crackpluskey.com/autodesk-3d-max-crack-key-2020-here/
    Autodesk 3ds Max Crack is the modelling and rendering software. Which is design for visualization, games and animations software? The 3d Max offers a flexible and rich toolset for the users that the user creates the premium design for full aristocratic control view. Therefore it creates a massive new world in the games industry. It gives high-quality visualization to architect workers. It models final interiors and all kind of objects which is used in them

  13. https://usecracked.com/adobe-photoshop-cc-full-crack-key-torrent/
    Cracked Here is a useful place where you can easily find Activators, Patch, Full version software Free Download, License key, serial key, keygen, Activation Key and Torrents. Get all of these by easily just on a single click.

  14. A text field is a single-line, fixed-height field, often with rounded corners, that automatically brings up a keyboard when the user taps it in Check us out

  15. When I was still in school, I used the services of my assistants and chose this site https://payforessay.net/, which I often visited for writing work, which got the job done quickly and efficiently.

  16. Dependably my best memories were just about playing in the casino. By and by, paying little psyche to whatever else I like to give bier haus slots different games a shot the web. You can get an enormous stack of money in a casino if you sort out some way to deal with play. In like way, I can help you and give you marvelous tips on the most talented procedure to play conclusively in a casino

  17. Presently many new companies are opening everywhere on the world, this can straightforwardly be known as the hundred years of new businesses, since all that can go to our brains we can carry out, having, obviously, a decent group of trained professionals and some sort of start-up capital. In each startup, a group of designers is vital, who will completely submerge themselves simultaneously and do all that could be within reach to guarantee that your startup is completely figured it out. Consistently an ever increasing number of organizations show up in any market, in any of their varieties. When beginning a totally new business, recruiting a whole group on the double is very expensive and risky, so you need to search for alternate approaches to communicate with the labor force. Recruiting a backbone js specialist for a recently taught business assumes a vital part later on result, so a positive result can be impacted from the beginning. A solid individual who comprehends everything being developed for a startup is critical, he is liable for the specialized execution. Practically all advanced new companies are computerized, so discovering web designers for them is turning into the fundamental assignment. In the event that you have a decent engineer, you will have an exceptionally brisk beginning, expanded creation, great quality.

  18. Letasoft Sound Booster Crack
    Letasoft Sound Booster Crack is software that will amplify sound volume to a brand new extent. It’s specifically useful for those wherever the system is supplied with larger music system capacities.

  19. Camtasia Studio Crack
    Camtasia Studio Crack is the best tool and facilitates the software for the records the screen and video editing. Therefore this tool is much professional and the best quality of software that has friendly and easy to use.

  20. FL Studio Crack
    FL Studio Crack provides the facility of creating the best and superb music ever. On the other hand, people can use it to produce the best collection of audio sounds.

  21. AnyDesk Premium Crack
    AnyDesk Premium Crack is the most popular and also brand-new software application used to design the fresh-looking interface. Also, this is the most versatile and even the light weighted application.

  22. Virtual DJ Build Crack
    Virtual DJ Build Crack is a powerful software that you can utilize for music and also for video mixing. This software is based on nearly all the abilities. That use of music and video quality enhancing.

  23. Tenorshare 4uKey Crack
    Tenorshare 4uKey Crack software lets to unlock all the locked all devices. Therefore, this tool uses to unlock all the forget pass easily. As you use the digit and secure the pass.

  24. Aster v7 Crack
    Aster v7 Crack could be your stage which transforms your own system to a multiuser channel. It is two or even more users to manually function on the personal computer at the same time. The particular settings lets multiple end-users to make use of a pc for someone stage.

  25. I really like your content. Your post is really informative. I have learned a lot from your article and I’m looking forward to applying it in my article given below!.
    TubeDigger Crack Free Download
    Enscape3D Crack Download
    Unity Pro Crack Download
    Idm Crack Download

  26. I wondered for a long time a nice girl I might chase. This issue was funded by a website. They thought of me immediately as the best service for finding slovenian women, who have changed my life for. Slovenian brides have the worry about women living by the sea, but they are much more interesting in their character and beauty. For those who want your love, I propose you. When you know that my new girlfriend is Slovenia, I don't regret using a bride placement services. I advise someone who wants love to have the internet.

  27. Hi! Thanks for this info. Are you interested in crypto trading? On my site you can watch a review of the best telegram channels with crypto signals free.

  28. 3DMark Crack
    3DMark Crack is a custom software of benchmarking for a Mac system. Produce through the Future Mark company. It also looks at the appearance of 3D graphics processing of a Pc. And also scans it to judge its speed.

  29. 3DMark Crack
    3DMark Crack is a special tool that use to measure the gaming performance of PC. It checks the system and hardware capability to make the overall performance. Also, this tool includes all the tools to measure all the device gamming

  30. Wondershare Dr Fone Crack
    Wondershare Dr Fone Crack is the best program, and it will help the users to regain the lost files and information. Further, it can recover information on your devices without any further issues.

  31. Adobe Acrobat Pro DC Crack
    Adobe Acrobat Pro DC Crack is application software. This software enables us to create a view and manage the PDF file easily. The adobe acrobat reader is easily available on the computer system and the mobile phone also.

  32. CCleaner Pro Crack
    CCleaner Pro Crack the best tool for MS Windows to clean out all kinds of junk files. Therefore, it also uses to clean the computer and make the system more smooth. While it also uses to secure the system to make the data secure.

  33. SimLab Composer Crack
    SimLab Composer Crack is the advanced software for creating professional and photorealistic animations. Users can take advantage of the form export formats in other related CAD software

  34. Golden Software Grapher Keygen
    Golden Software Grapher Keygen is a full-featured scientific graphics package, allowing the user to import data in many formats, create and integrate a variety of 2D and 3D graphic types, and customize graphics with unlimited detail.

  35. https://proscrack.co/angry-birds-epic-crack/
    Angry Birds Epic Serial Key was a success because it wowed gamers with great gameplay and unforgettable characters. For this reason, Rovio Entertainment has taken the right step by using its success to create sequels and spin-offs like the Angry Birds Epic RPG. In this game, the birds prepare for a new adventure as they head to Piggy Islands.

  36. The student doesn't have time as they're working as well as studying, so they can't do the best essay they can themselves. Looking to free up your time homework help cpm? Consider the essay writing service! Let's face it; there are not enough hours in the day to write essays.

  37. Toon Boom Harmony’s free download provides design, drawing, and animation tools for young artists with enhanced performance. Provides drawing and animation tools for artists. This Website

  38. 4K Video Downloader crack
    4K Video Downloader Crack is the best and the most powerful software and it comes with proficient features to convert your videos to different formats.

  39. ESET Smart Security Premium

    this software is the best solution for you to keep your devices healthy. Further, it will allow you to notice and handle the catalog synch and the administrator.

  40. iMyFone LockWiper crack
    this is the latest software that you can use as an unlocker. This application can be used when you sometimes forget any device password.

  41. AVG Internet Security crack
    this is the best and the most powerful software that can help the users you get amazing protection for their devices.

  42. Visual Watermark crack
    this is an efficient and fantastic app, and it is used to add different types of watermarks to your pictures and images

  43. Is this a paid topic or do you change it yourself?
    However, stopping by with great quality writing, it's hard to see any good blog today.
    3DMark Crack
    Avira Antivirus Pro Crack
    Slate Digital VMR Complete Bundle Crack
    Advanced SystemCare Pro Crack
    3D Coat Crack

  44. This site have particular software articles which emits an impression of being a significant and significant for you individual, able software installation.This is the spot you can get helps for any software installation, usage and cracked.
    3DMark crack
    Jixipix Rip Studio Crack


  45. Thanks for sharing keep it up i like your content links given below!

  46. https://www.zgamespc.com
    Crack Software Download Free 100% Working Keys & Crack.

  47. https://latestcracked.com/
    Here You Can Download New Crack Software Download Full Free Of Cost

  48. https://keystool.com/
    If You Want New Crack Software With Latest Version Please Visit here.

  49. I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I’ve got you bookmarked to look at new stuff you post…

  50. Techsmith Camtasia Studio Crack With Serial Key Free Download Techsmith Camtasia Crack is a software suite for creating and manipulating videos in high definition by recording screen activity. However, it is the complete professional solution for recording, editing and sharing high-quality screen video on the Web. CD-ROM and portable media players, including iPod. With support

  51. I guess I am the only one who came here to share my very own experience. Guess what!? I am using my laptop for almost the past 2 years, but I had no idea of solving some basic issues. I do not know how to Crack Softwares Free Download But thankfully, I recently visited a website named vsthomes.com
    Plugin Boutique Scaler Crack
    Flvto Youtube Downloader crack
    Tenorshare 4uKey Crack
    Google Chrome crack
    Tenorshare UltData crack

  52. The crack analyzer data for tonal balance control is based on thousands of tracks of different genres. The algorithm has to parse different songs to obtain average information about the shape of the frequencies in metal, rock, hip-hop, jazz, and other styles. Iztope Tonal Balance Control Crack

  53. Appreciation is a wonderful thing...thanks for sharing keep it up.Letasoft Sound Booster Crack

  54. This comment has been removed by the author.


  55. I am a blogger I am a regular visitor i read your article, nice job its so interested and also provide use ful information and also visit my website

  56. Hey i read your article, good work its so interested I am a regular visitor and i always visit your posts and also provide use ful information and also visit my website

  57. Very wonderful informative article. I appreciated looking at your article. Very wonderful reveal. I would like to twit this on my followers. Many thanks!

    taylor olsen

  58. WonderFox DVD Ripper Crack can convert DVD movies to various formats like AVI, MP4, MKV, MPG. Supports popular video formats and types of DVD movies. The software can remove various locks such as CSS, region code, multi-angle, RCE, Sony ARccOS, UOP and Disney X-Project. Ripping a DVD to AVI and 5 to 10 MPG takes about 20 minutes. WonderFox DVD Ripper Crack is simple and only in three steps (Dario DVD selection – search storage and format – start ripping and converting). Despite the high extraction speed, the original quality of your video is preserved. It offers flexible options to adjust and adjust parameters to adjust the output video in terms of video audio coding, bit rate, frame rate, aspect ratio, resolution, audio codec, audio channel number, sampling frequency etc. You can download from this link https://crackclick.com/wonderfox-dvd-ripper-crack/

  59. Nice explanation and article. Continue to write articles like these, and visit my website at https://usacrack.info/ for more information.
    Parallels Desktop Crack
    XYplorer Pro Crack
    Teorex Inpaint Crack

  60. https://crackedpro.org/wondershare-recoverit-key-2021-cracked/

    Wondershare Recoverit Crack is a powerful and recovery software. Lost data easily recover with the help of this software. So, it is reliable recovery software. It recovers all types of data including image video documents and many more. It provides a user-friendly environment.

  61. https://crackedsoftpc.com/ccleaner-pro-2021/

    CCleaner Pro 2021 Crack is much convenient program that is best for cleansing your driver. There are a lot of attributes in the startup manager and use to get and make a registry of your cleaner. While there are a lot of tab revealing choices that make the other new alternative for that. Overall, if you set that on using a new automatic tool use it to repair and make brought up.

  62. https://softscracked.com/automatic-mouse-and-keyboard-crack/

    Automatic Mouse and Keyboard Crack is a good and very useful application which allows you to go the mouse pointer over the road you designate, and also reveal where in fact the click will be produced. Agree, a significant universal opportunity, which can only help to handle a number of very diverse jobs. Suppose you will need to save lots of a whole lot of images from the web

  63. https://crackedhere.com/avg-internet-security-cracked-2019-keys/

    AVG Internet Security 2021 Crack is also known as Anti-Virus Guard and is a family of anti-virus software developed by AVG technologies. This software is available for the windows, android, and macOS, and also provide antivirus protection for all applications. AVG internet security is software that protects all personal devices effectively.

  64. https://activatorskey.com/sublime-text-cracked-plus-keygen/

    Sublime Text is a proprietary cross-platform source code change software. It is introduced by the ‘Jon Skinner’, ‘Will bond’. Sublime Text can operate on Linux, Mac OS X, and Microsoft Windows

  65. I like your all post. You have done really good work. Thank you for the information you provide, it helped me a lot. I hope to have many more entries or so from you.
    Very interesting blog.visit my wepsite https://vstking.net/

    Slate Digital VMR Complete Bundle crack

    Camtasia Studio Crack

  66. Sony Vegas Pro Crack
    Sony Vegas Pro Crack is a great software that you can use for modification means the editing of any type of video if it is for your cooking video or video about any course or any short clip.

  67. Smart Game Booster Crack
    Smart Game Booster Torrent enhances your personal computer even whenever you’re not taking part in any matches, with no remarkable side effects.

  68. Smart Game Booster Crack
    As we know heavy graphics are very in nowadays. Moreover, game lovers need an app that makes them free from the tension of junk and the hurdle of PC when playing games.

  69. EASEUS Partition Master Crack
    EASEUS Partition Master Crack is the wide tool that use to manage the system and other partition of the software.

  70. DxO PhotoLab Crack
    DxO PhotoLab Crack is a professional and powerful image tool that use to edit the software. Therefore, this tool is capable to produce the system and make the tools that are there in the market.

  71. Wondershare Dr. Fone Crack
    Wondershare Dr. Fone Crack is the perfect software healing software and it helps you to get the best experience.

  72. EaseUS MobiMover Crack
    EaseUS MobiMover Crack acts as the fast app that functions as the data recovery tool for the IOS directory.