I am working on an easy RSS reader for myself. I'm new to Objective-C, so I'm stuck at one point. There is an add button on the application's navigation bar, which opens a UILETiew with a text field where the user inputs the RSS feed URL. Know a predefined RSS feed in the source code of the application. I am writing my code example below:
- (zero) viewDidoadload {[Super Viewedload]; Self.feeds = [NSArray arrayWithObjects: @ "http://www.formula1.com/rss/news/latest.rss", zero]; Feeds are a predefined array in which the feed is detected. I tried the code below to get the text, but this did not work. In addition, how does the application take that URL from the textfield and change it with the predefined one?
- (zero) myAlertView: (click on UIAlertView *) AlertButtonAntindex: (NSInteger) ButtonIndex {if (buttonIndex == 1) {// OK Push // [Data addObject: myTextField Text]; }
In a UIAlertView, there are zero-index buttons if your only button is OK It should be:
if (buttonIndex == 0) In addition, if I understand you correctly, Place of text. The answer will depend on the textfield, but I recommend that you give your textfield the tag as follows:
myTextField.tag = 10; // Any number should work Now you can access that textfield along with the method view: On the view of his parents
If the text file is in the main view, then you will get the following (within your View Controller):
UIT ext filed * textfield = (UITField *) [self.view viewWithTag : TagNumber]; // tagnumber which you have specified in the field textfield.txt = [self.feeds objectAtIndex: 0]; This would be the same if the field was in the address book (clicked button at the endx method): UIFETFIFFED field * textfield = (UITField *) [alert viewview tag: tagname]; // tag number, which you call field textfield.txt = [auto. Feeds objectswithindex: 0];
Edit, I have written you and then understood the question better. I am unsure of why you are storing a URL in an array (unless you allow them to enter multiple arrays).
If yes, then you do not really have a predefined requirement, but to remove it, you can do the following in the ButtonAntX method:
[self. Feeds removeAllObjects]; [Self. Feeds adject: textfield.txt]; This should remove your predefined string and add a new one. Enter code here
Comments
Post a Comment