Adding a Dotted red line under characters in a UITextView

I am trying to create my custom spell checker for the UITextView.
To show that a word is misspelled, I need to add the "red dotted line" under the misspelled word. To do that, here is what I thought would work -
I create a dictionary which contains the values for the key NSUnderlineStyleAttributeName. However, what this does is, it does underline the characters but it does not have a dotted pattern. Also, setting the strokeColorAttribute also does not seem to have any effect.
Here is my code -
NSMutableDictionary *misspelledAttributes = [NSMutableDictionary dictionary];
[misspelledAttributes setObject:[NSNumber numberWithInt:kCTUnderlineStyleThick|kCTUnderlinePatternDot] forKey:NSUnderlineStyleAttributeName];
[misspelledAttributes setObject:[UIColor redColor] forKey:NSStrokeColorAttributeName];
To set the attributes to a attributed string for a particular range -
NSMutableAttributedString *attrString = [self.textView.attributedText mutableCopy];
[attrString addAttributes:misspelledAttributes range:wordRange];
self.textView.scrollEnabled = NO;
self.textView.attributedText = attrString;
self.textView.selectedRange = NSMakeRange(NSMaxRange(range), 0);
self.textView.scrollEnabled = YES;

I agree that the NSStrokeColorAttributeName is not the correct property to use. I am not able to edit my post to remove that piece of code.
I am trying to do this for my iOS project and NSUnderlineColorAttributeName is not available for iOS yet. It is only available for OSX. I just checked that in the developer library.
Am I missing something here?
Also, I am unable to add a "dotted" underline. All I can do is put a single line under the text. is Apple allowing us to only put a single line and not any of the other types of underline styles such as dashed, dotted etc.?

Similar Messages

  • Funny red line under link

    Hi
    I posted this issue last night as part of a larger issue which has been solved, so I am reposting this by itself.
    website: www.jeffwenzelart.com
    problem: on home page there is a link to biography, when you click on that link you are taken to the bio page which has 4 links on the side: Bio/CV/Statement/Selected Reviews. Those links are set up using Arial 12 pt regular type, they all remain dark grey no matter what you do (rollover, click etc.) The active link is always in red, bold, arial 14pt type, and stays in red until you click on another link.
    This all works fine and as intended except on the "Selected Review Page". When you are on the "selected review" page Biography is in a different grey color, is bold, and appears with a thin red link line under it...on my screen the red line goes away when I move my cursor over it, but it comes back if I leave that page and return to it
    I have checked and rechecked using inspector to see that I have the correct properties assigned to the link (I do) I have removed all four links from all of the associated pages and rentered them individually as opposed to cutting and pasting...and nothing makes it change.
    I am wondering if that is how it displays to others, and how the heck do I fix it

    thanks for the reply, and let me first say I am not trying to be difficult, but I am trying to understand the problem
    the links are NOT in individual text boxes (primarily to control the amount of space between the lines...I like that sort of tight spacing).... they are in one box, with each line being made a link.
    in addition, on the bio/cv/and statement pages the links are set up that way (one text box) with no issue....they each perform as I expected.
    also, on the selected review page all of the reviews on the page are in one big text box...but there is considerable more spacing between the linked items, and they seem to perform correctly as well.
    can you help me understand the difference between individual text boxes, and a big one with lots of links in it...what problem am I creating by doing it that way.
    I will certainly make the links individual boxes, if you think it will work....it's an easy thing to do, and if it solves the problem that would be great.
    Now here is something I did just a bit ago...and it seems like it might be important to figuring the problem out, but it could just be craziness too, but would you mind reading what I did and tell me if I was going in the right direction, or if it just doesn't have any bearing on the problem.
    it was suggested to me that I had an issue with my css files (this is getting above my head) but in an attempt to figure this out, after I published the site to a folder, I looked in the files for Bio/Statement/CV and/ Selected Reviews because I thought maybe if they looked vastly different it would be a clue as to what the problem is.
    The CV/BIO and /Statement files all had just about the same types of things in them, they each has 13 items in them...mostly shape images....but the Selected Review file had 21 items in it....it had 9 more shape images than the other files...maybe it is unimportant but it seems weird to me; it was also missing some of the same files the other pages had.
    I decided to remove the Bio etc links from the "selected reviews" page, and I republish the site to a folder and once I did that there were only 12 items in the Selected Review file....so I uploaded it to my host....I accessed the website and there was no change ....the removed links still appeared there, and the bio link was still bold with a red line under it....I expected that they would not be on the page at all...why was it pulling an old version of a page I had overwritten ( or thought I had)....where is that page , where is it pulling it from? I don't understand this aspect.
    so I have gone back to iweb, recreated the links and reposted the site and there is no change at all....so I have deleted the links, and then I added them back and there is no change in any version.
    Thanks for anything you can offer to help.

  • Problem with RED LINE under text in iDVD 5?

    Can anyone help me. When I complete an iDVD project, there is always a RED LINE under the text on the menu. When the DVD is burned and I play it on my DVD player, there will be this annoying RED LINE flashing underneath the text. Does anyone else have this problem? Please let me know if there is a setting that needs to be changed. Thanks!

    Tim:
    Welcome to the Apple Discussions. Can you include some additional information on your setup, similar to what's in my profile? Also give your HD size and free space, exact version of the system and iDVD, the theme you're using and which text, title or button, that you're having the problem.
    OT

  • Silly questions but new on apple, Q1 how do I cut and paste Q2 when I have a spelling error with the red line under it how do I correct it?

    Q1 How do I cut and paste
    Q2 how do I correct a spelling error when it has a red line under it?

    Lynnie2002 wrote:
    Q1 How do I cut and paste
    Highlight the item.
    Finder>Edit>Copy
    Place the item where you want to
    Finder>Edit>Paste
    There is 3rd party software that makes cut & paste easier with just 1 or 2 steps. 
    Q2 how do I correct a spelling error when it has a red line under it?
    You can find the correct spelling in the Apple dictionary.  Just add the correct spelling & delete the error.
    Care to share which OS you are using and which model iMac you have? 

  • Why are there red lines under my text - Galaxy S5

    I use the stock keyboard on my Galaxy S5.  Out of the blue, red lines started appearing under almost every word when I text, although I did not change the settings.  I tried turning off predictive text and auto correct, but nothing has worked.  Has anyone else experienced this issue?  This is just the latest in a long line of odd things that have occurred since lollipop!

    Thanks for reaching out to us on this matter mmd78! Let's investigate the red lines together. May I ask are the words spelled correctly? We want to make sure that it's not spell check. If it is then this can be changed in the settings. If the words are spelled right then please check the language that you have activated on the text app. This is also a common scenario that we see. Once you have done so, please keep us posted with your finding.  ArnettH_VZW Follow us on Twitter @VZWSupport If my response answered your question please click the "Correct Answer" button under my response. This ensures others can benefit from our conversation. Thanks in advance for your help with this!!

  • Red Line for Spell Check Disappears

    I have "auto-correct" turned off, but "spell check" turned on.  As I am typing a text, if I misspell a word, it will immediately put a red line under the word, then if I start to type another word without fixing that one, the line will disappear even though the word is still spelled wrong.  However, if I go and highlight the word, it comes up with suggestions to correct the spelling.  What is the problem?

    Well, I've not experienced different behavior. Although that does not mean mine is absolutely correct. It seems that if you go past a misspelled word, the iOS is determining you want it spelled that way. I just got my iPhone 5s, so I intend on doing some experimenting since I wrote my response to you the other day. I just haven't had the time yet. It seems to me if I remember correctly, that even though it disappears at first, when I finish a text that they appear again.

  • Red lines surrounding mouse cursor arrow, shutdown

    noticed that four small dotted red lines have appeared around the cursor arrow..lines only follow mouse movement and do not appear anywhere else on the screen...my imac just now froze as i was scanning in a pic. i've done a manual restart and everything looks fine, starts to go through the "your computer did not shut down properly" screen without a hitch and then the dancing red lines appear. mac can make it through this screen but then freezes in main startup. this is the third time ive had to do a hard shut down. ??
    has anyone run into the dancing red lines before? any suggestions?
    any help is greatly appreciated
    (btw: accessing internet from a pc at work)
    imac   Mac OS 9.2.x  

    Hi, monica -
    Just a thought - do you have the CloseView control panel installed? If so, try turning CloseView off within that control panel, or use the keyboard shortcut to toggle it off, which is Command-Option-K.
    If you can't get the machine booted successfully to get to that control panel, then try booting with Extensions Off - hold down the Shift key from the start of booting until the desktop has fully loaded.
    Then drag that control panel out of the Control Panels folder (in System Folder) and restart. I'm not sure if that control panel uses an associated preferences file, but you might look for one (System Folder >> Preferences) - if there, remove it to the desktop also.

  • Red dots and lines

    In Half Life 2 and need for speed underground 2 I get some red dots and lines
    I never had this problem before and its not artifacting and they only shows where its light, like infront of the headlights on the car in need for speed..
    Anyone knows whats the problem is?   please its very anoying  

    anyone knows what the problem is? if i have the card at 520/560 its ok. I have been playing 24 hours without any problem now.. I have played CS, NFSU2, HL2 and savager.. no prob at all.. I was on LAN this weekend  

  • How do i right click when a red line appears under a misspelled word?

    i need help. im new to pages, and when i misspell a word a red line shows up underneath just like in micrsoft word, but the problem is i dont know how to correct it. how do i right click to view the correct spelling?

    Double-click to highlight the word & then right-click just as you would anywhere elese. Suggestions will be at the top of the list. Many times there are no suggestions.
    Of course, make sure secondary click is turned on in the mouse preferences in System Preferences.

  • Contribute cs5, adding a line under another sentence

    Please see www.valetingcars.com on the right you will see a price list, when i try to insert another line under FULL VALETS it drops down 2 spaces instead of one, this happens all over the page when i try to insert another line.
    Can anyone tell me why, and how to correct this as i only want to add another line underneath.
    Thanks

    Thanks for that it worked, however if you look at my site www.valetingcars.com you will see right at the top an extra bar since i changed the setting in contribute. My host said they will sort that out for me so no problems. Thanks for the help.

  • My battery drained. Screen shows battery with red line but doesn't seem to be recharding after 20 min.  Should I wait or do a hard restart? I haven't backedup in ages and don't want to lose pics, contacts etc.

    My battery drained. Pluged in to wall but screen shows battery with red line but doesn't seem to be recharding after 20 min.  Should I wait longer or do a hard restart? I haven't backedup in ages and don't want to lose pics, contacts etc.  Will a hard restart wipe all that out?

    Agree with Richard:
    -Your device needs both the CR and LF. To accomplish this:
    option 1: Concatenate the "end of line" string constant (this is a combination of CR and LF, located in the string pallete) to all your outgoing commands. Make sure in the "Visa configure serial port" the "Termination character enable" flag is false.
    option 2: Concatenate only a CR to your command's strings. Make sure in the "Visa configure serial port" the "Termination character enable" flag is TRUE AND that the termination character is set to 10 (meaning LF) which I think is the default.
    Details can be seen in this link:
    http://digital.ni.com/public.nsf/allkb/862567530005F09C862565BE005AB500
    "Adding Termination Characters to VISA Serial Writes in LabVIEW"
    Interesting would be to configure the serial port to accept not one but two termination characters. The above links refers to the document "Developer Zone Tutorial: Termination Characters in NI-VISA.", where this is supposed to be possible. The document however is 404'ed.
    If someone find a working link please post it.
    Regards

  • Adobe Premiere Elements - Red Line / Green Line

    I have spent this past weekend working with Premiere Elements on my Mac (just purchased it along with Photoshop Elements 9).  I can't seem to find a manual for it so so far I have been forced to work with it based on intuition.  Thus far, I have been surprisingly successful.  However, I do have some questions.
    I have imported some videos that were previously ripped from DVDs into Organizer.  I have place several clips into the timeline and made mostly edits like cuts and removal of audio files attached to the video files (no effects and no transitions).  I have also imported an audio file (formatted in apple AAC) into the timeline that was purchased from iTunes.  What I noticed is that there is a red line on top of the timeline and I am not sure why (not even sure what that means).  While I'm editing, the program runs pretty sluggishly (ie. scubbing through the timeline is very blocky and not smooth) but so far it has not crashed.  Also, the video quality while viewing on the timeline is somewhat poor.  However, once I render the project to a .mov file it looks great and all the edit points I have done is on point and synced with the music.
    Can someone provide insight for a newbie?

    The red line indicates that the content under the timeline is not "native". When you click on the timeline and then hit the "Enter" key, you will see a progress bar that converts this area under the red bar to native properties and turns the bar green. Native to what? Native to the project presets.
    When you launch a new project you will notice a small information under the project name etc, that looks something like "NTSC DV" or "Full HD 5.1 1920x1080i 30" etc. This is the settings in which the clips are to be imported. If you are sure about the exact properties of the clips that you will import and edit, I suggest you change these project settings manually when you create the new project. Else, all you have to do is launch a project with ANY setting, and enter a single file from what you have imported to the organizer. The switch to a correct project will happen automatically. Hopefully the other clips that you have for this edit session are from the same camera/with same properties. When native, there are no Red/Green bars above the clips.
    The other thing about the red/green bar is that if any property of the clip is altered, (adding effect, changing opacity, changing the duration, placing any other asset above the clip etc) the bar WILL turn red. That is when you might see the playback issues. To correct this, you must render and then once green the playback will be really smooth.
    And regarding your query about changing the project while you are editing, you cannot do that in Premiere Elements. If you have started editing in a particular project setting, you can save it, and continue editing later. But when you reopen the same project, the settings will be the same as the ones you created/switched to the first time.

  • [SOLVED] terminals & line drawing characters problem

    I use quite some escape sequences in my bash prompt, amongst them a few that produce line drawing characters. Works fine in the virtual consoles (tty), but no terminals in X (tried xterm, terminal, urxvt) display them correctly, for some reason. My locale settings seem fine, and I've tried various fonts (including the one I use in the virtual consoles).
    What could the issue be?
    FYI, my bash prompt variable. Does it display correctly for you?
    DRED='\e[0;31m'
    DGREEN='\e[0;32m'
    DYELLOW='\e[0;33m'
    DBLUE='\e[0;34m'
    DPURPLE='\e[0;35m'
    DCYAN='\e[0;36m'
    DWHITE='\e[0;37m'
    LRED='\e[1;31m'
    LGREEN='\e[1;32m'
    LYELLOW='\e[1;33m'
    LBLUE='\e[1;34m'
    LPURPLE='\e[1;35m'
    LCYAN='\e[1;36m'
    LWHITE='\e[1;37m'
    COLRESET='\e[0m'
    PS1="\n\[$DBLUE\]\[\016\]l\[\017\]\[$DRED\](\u@\h)\[$DBLUE\]\[\016\]qqq\[\017\](\[$LBLUE\]H\!\[$DBLUE\])\[\016\]qq\[\017\](\[$LBLUE\]C\#\[$DBLUE\])\[\016\]qq\[\017\](\[$LBLUE\]J\j\[$DBLUE\])\[\016\]qqq\[\017\](\[$LBLUE\]\D{%H:%M %A %d - %B %Y}\[$DBLUE\])\n\[\016\]t\[\017\]\[\016\]q\[\017\](\[\[$LBLUE\]\w\[$DBLUE\])\n\[\016\]mqq\[\017\]> \[$LBLUE\]"
    Last edited by Mzg (2010-07-09 10:00:41)

    After some detective work I have managed to come up with an explanation as well as what seems to be a working solution.
    If you have not tried the prompt above, basically I tried to use some line drawing characters in my bash prompt, but these refused to display correctly under any X terminals I tried (though it looked fine on virtual consoles).
    The problem was in the
    \[\016\] ... \[\017\]
    sequences. The \016 escape sequence is supposed to enter the alternate character set mode (common way to draw e.g. lines in text mode) while \017 returns the terminal to the standard character set. These work fine on the virtual consoles, but are apparently a no-no in (some) X terminals. If you tried the prompt you would notice that the color escape sequences worked fine, only the line drawing characters failed.
    So that is the explanation part. So for the solution...
    For urxvt, which is my preferred terminal emulator, the solution is quite simple. This should also work with other rxvt-derived terminals (including the popular aterm), though I have not tested this.
    These terminals offer the same functionality as the virtual consoles, though the escape sequences are different. "\033(0" enters alternate charset mode while "\033(B" returns to standard charset mode. So the solution is simply to replace all previous
    \[\016\] ... \[\017\]
    sequences with
    \[\033(0\] ... \[\033(B\]
    But this poses a problem, as the virtual consoles do not recognize these sequences and you'll get the same problem as before, only in text mode instead of X. I solved this by using the PROMPT_COMMAND variable to run fgconsole every time a command is ran in bash, checking if the command is ran in tty7 (i.e. X11) or in one of the (other) virtual consoles. This is my code for the root prompt:
    DRED='\e[0;31m'
    DGREEN='\e[0;32m'
    DYELLOW='\e[0;33m'
    DBLUE='\e[0;34m'
    DPURPLE='\e[0;35m'
    DCYAN='\e[0;36m'
    DWHITE='\e[0;37m'
    LRED='\e[1;31m'
    LGREEN='\e[1;32m'
    LYELLOW='\e[1;33m'
    LBLUE='\e[1;34m'
    LPURPLE='\e[1;35m'
    LCYAN='\e[1;36m'
    LWHITE='\e[1;37m'
    COLRESET='\e[0m'
    function prompt_func
    # Running in tty7 or larger (X11)
    if [ `sudo fgconsole` -gt 6 ]
    then
    PS1="\n\[$DBLUE\]\[\033(0\]l\[\033(B\]\[$DRED\](\u@\h)\[$DBLUE\]\[\033(0\]qqq\[\033(B\](\[$LBLUE\]H\!\[$DBLUE\])\[\033(0\]qq\[\033(B\](\[$LBLUE\]C\#\[$DBLUE\])\[\033(0\]qq\[\033(B\](\[$LBLUE\]J\j\[$DBLUE\])\[\033(0\]qqq\[\033(B\](\[$LBLUE\]\D{%H:%M %A %d - %B %Y}\[$DBLUE\])\n\[\033(0\]t\[\033(B\]\[\033(0\]q\[\033(B\](\[\[$LBLUE\]\w\[$DBLUE\])\n\[\033(0\]mqq\[\033(B\]> \[$LBLUE\]"
    else
    PS1="\n\[$DBLUE\]\[\016\]l\[\017\]\[$DRED\](\u@\h)\[$DBLUE\]\[\016\]qqq\[\017\](\[$LBLUE\]H\!\[$DBLUE\])\[\016\]qq\[\017\](\[$LBLUE\]C\#\[$DBLUE\])\[\016\]qq\[\017\](\[$LBLUE\]J\j\[$DBLUE\])\[\016\]qqq\[\017\](\[$LBLUE\]\D{%H:%M %A %d - %B %Y}\[$DBLUE\])\n\[\016\]t\[\017\]\[\016\]q\[\017\](\[\[$LBLUE\]\w\[$DBLUE\])\n\[\016\]mqq\[\017\]> \[$LBLUE\]"
    fi
    PROMPT_COMMAND=prompt_func
    Note that I do not claim to be a good bash programmer, so there might be better ways. This has however worked flawlessly so far, including when su'ing to other users, and switching between tty's and X.
    The code is the same for my other users, except from the colors. Note the
    `sudo fgconsole`
    Sudo proved necessary for non-root users. I added an entry in the sudoers config file to let all users run fgconsole as root without providing a password.
    Okay, that's it. It's a bit dirty, but it solved my problem at least.
    Last edited by Mzg (2010-07-10 07:06:44)

  • Encore / Images Blacked out with RED line on top

    New at this. I have 1.67gb left in my project. (I have a lot of photos) Any way when I add more (Shift / Ctrl / g ) When I look at the bottom Left where the slides show up I just loaded 2 of the 60 photos I can see but the other 58 are black. All 60 have this red line above them.
    Can anyone teach me what's going on here:)
    THANKS

    Joseph,
    You are possibly (note: "possibly") on the right track with the elimination of each slide show, until you find the one that is "possibly" causing the problem.
    Get a spool of DVD-RWs (rewritables), and do a Project with one of your slide shows, then burn to DVD-RW and test that. Does all work as it should? In that Project, add another slide show, repeat the DVD-RW burn again. Still OK? Add another, and another. If the process hangs, errors out, on one, check it completely to see if you can spot a problem with it. Sometimes, it's some tiny glitch that ruins the whole Project, and you have to spend some time searching through tons of good assets, just to find the offending one, or ones.
    As for the size concern, take a look at the Disc Tab in your Project Panel. There will be a diagram of the DVD with the used portion colored in. Does it show that you still have room? If not, check the CD-ROM area, just below, to see if you accidently added some content there. If you have exceeded the capacity of a 4.7GB DVD, Encore should give you an error message, suggesting that you go with a DVD-9 (Dual Layer), instead of a DVD-5.
    Question: where did you get the info, that you still have 1.38GB of space on this Project, the Disc Tab in the Project Panel? If so, that should tell you that you DO have room, i.e. the Project is not too large. It would then follow, that you likely have some problem and my first statements might help you track these down.
    Good luck,
    Hunt
    [EDIT] PS, Harm is only trying to help you explain your problem in enough detail, so that the folk who hang out here, can, in turn, help you solve your problem. As you can see from my response, I'm doing a lot of guessing, and much/all of it might be wrong. With more detail (per Harm's link), others will see what you started with, what you have done so far, and maybe even some hardware issues. The first couple of folk, who responded to you, are some of the best on this board.

  • MY new Ipod Nano does not hold a charge.  I use it mostly as a watch, perhaps look at it 5 or 6 times in 8 hours, and leave it in sleep mode the rest of the time.  I drains to the red line in less than 2 days.  My husband's nano will last a week this way.

    MY new Ipod Nano does not hold a charge.  I use it mostly as a watch, perhaps look at it 5 or 6 times in 8 hours, and leave it in sleep mode the rest of the time.  I drains to the red line in less than 2 days.  My husband's nano will last a week this way.  I thought it drained because of looking at photos, so I quit looking at them and it made no difference.  Am I doing something incorrectly to cause this short battery life?

    You are still under warranty if your iPod is "new."  Take full advantage of it by either calling iPod tech support, Apple Care if you have it or take it in to an Apple store or an AASP.  Whichever is more convenient for you.

Maybe you are looking for

  • BADI or User exit  for FB50 to update custom field in table COEP

    Hi all, i have added one custom field in table COEP through include CI_COBL . when i do posting through sales order(VA02) or purchase order(ME22n) that custom fields in COEP get updated with controlling document and through BADI AC_DOCUMENT i m updat

  • Re-Download Acrobat 9.0 Standard

    Hi, My computers were recently damaged in a fire and I baught all new computers and need to reintall Acrobat 9.0 standars on all computers, however, i do not have the original disc.  Is there any where that I can dowmload this software, I have the se

  • Count number of records in a internal table

    hi i want to count number of records in internal table pls let me know how to count the number of records in a internal table. regards Arora

  • Bridge Web Gallery Photos Not Loading

    Just upgraded from CS4 to CS6.  I had been using the Create Web Photo Album command in CS4 which of course is no longer available. So, opened Bridge and created an HTML Web Gallery.  The HTML Gallery looks great and when I open it with DW locally it

  • TIP: Use VNC for Headless Leopard Server Installs

    Wish I had figured this one out before... Quick little tidbit for all those installing Leopard Server on a machine that doesn't have a display. You can use server admin tools and 'Server Assistant' running on a different box. Or, once the installer h