Questions tagged [nsrange]

A structure used to describe a portion of a series—such as characters in a string or objects in an NSArray object.

343 questions
0
votes
1 answer

Translate rangeOfString from Objective-c To Swift

I'm trying for hours to translate this short code. Objective C : NSString *urlStr = [request.URL absoluteString]; NSArray *urlParts = [urlStr componentsSeparatedByString:[NSString stringWithFormat:@"%@/", kREDIRECTURI]]; if (urlParts.count > 1) { …
Roi Mulia
  • 5,626
  • 11
  • 54
  • 105
0
votes
3 answers

How to identify offensive words in UITextField?

I am developing a iOS Chat Application, Here i have a scenario where i have to identify user entered text contains any Abusing words on my submit button action.I have a big list of abuse words to identify. I have used the below code to identify the…
0
votes
0 answers

Strange return of RangeOfString method

Little explanation of the code : I have a dict that looks like this : HC_1 : test1, HC_2: test2, .... If I find HC_1 in the "theModifiedReportTemplateContent", I look for the first ">" after and I add "test1". …
Kaki
  • 33
  • 6
0
votes
1 answer

NSTextView -(void) setMarkedTextAttributes: method how to set which text is marked?

NSTextView has a -(void)setMarkedTextAttributes: method. But can I mark text NSRanges programmatically ? can I mark text the same way as I can select NSRanges ? Thanks for any help.
Alfonso Tesauro
  • 1,730
  • 13
  • 21
0
votes
1 answer

How to clickable UILabel's Text

I want to make some text clickable in uilabel. Here is the text where Privacy Policy and Terms of Service should be click-able. By tapping to continue you are indicating that you have read the Privacy Policy and agree to the Terms of…
Sonu
  • 937
  • 1
  • 10
  • 39
0
votes
1 answer

Need to get NSRanges of multiple @ symbols and the text that follows them in UILabel's text

I have a UILabel that contains text like this: "Hi, my name is John Smith. Here is my twitter handle @johnsmith and I work for this company @somerandomcompany. Thanks for watching!" I need to find the ranges for all of the @ symbols and whatever…
user3344977
  • 3,584
  • 4
  • 32
  • 88
0
votes
2 answers

cannot invoke '!=' with an argument list of type (@lvalue Bool, ($T5))

The title is the error message that I get while compiling this code snippet @ line3: var categoryMatch = (scope == "All") || (candy.category == scope) var stringMatch = candy.name.rangeOfString(searchText) return categoryMatch && (stringMatch !=…
PK86
  • 1,218
  • 2
  • 14
  • 25
0
votes
1 answer

How to get a NSRange Value from NSConcreteValue?

The code is like this. My question is how to get the NSRange value from the id type? -(void)clicText:(MyLabel *)label clickedOnLink:(id)linkData{ NSString *message = [NSString stringWithFormat:@"LinkData is %@:%@",[[linkData class]…
0
votes
1 answer

UITextView setSelectedRange issue

I have subclassed UITextView with the goal of introducing placeholder functionality. It's mostly working well, but I'm having issue with the behaviour when the UITextView becomes active either by user tap or by calling becomeFirstResponder. Below is…
artooras
  • 6,315
  • 9
  • 45
  • 78
0
votes
1 answer

Value stored to 'currentRange' during its initialization is never read?

After analyzing my project, I seem to be getting the following warning: Value stored to 'currentWordRange' during its initialization is never read for the following lines in viewDidLoad: if (self.wordToAdd && self.wordToAdd != (id)[NSNull null] &&…
KingPolygon
  • 4,753
  • 7
  • 43
  • 72
0
votes
1 answer

delete a character from a string Xcode

I am using the following code to add a character to a mutable string then put it into a textview from a custom keyboard - (IBAction) press:(id)sender { [[UIDevice currentDevice] playInputClick]; if (sender == AEE) { self.BACK.hidden…
user1114881
  • 731
  • 1
  • 12
  • 25
0
votes
2 answers

How does NSrange work here?

I watched a video about ios7 programming and saw piece of codes below. I can not really understand how the variable range works here. We create a NSrange variable range and never give it a value, so I think the &range pointer should return nil. Then…
0
votes
3 answers

How do I get the date (not time or any alphabetic characters) from this NSString?

I have an NSString that prints: recent update Last Updated: 10/02/2014 03:22:PM I want to get this date only 10/02/2014. How will I go about doing this? Any suggestions or tips are appreciated. I am guessing I need to use NSRange, but I am not too…
user3606054
  • 591
  • 1
  • 5
  • 14
0
votes
2 answers

How to change the color of Text on tap in Textview

I need to change the text color on tap in UITextView. I got NSRange on selected text of text view but unable to change its color using this code. [mutableAttributedString addAttribute:NSForegroundColorAttributeName value:[UIColor…
user2524618
  • 237
  • 1
  • 2
  • 15
0
votes
1 answer

Trying to delete a character within a string in a UITextField using backspace

I have a UITextField in my application where I allow the user to enter and delete text. I am implementing the UITextFieldDelegate method: - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range…
syedfa
  • 2,801
  • 1
  • 41
  • 74