Sqlite in a textview - iphone

Is it possible to display a sqlite values in a textview?I have made it in a tableviewcontroller,but i am not able to display the same in a textview. appdelegate.biblearray is the array that holds the sqldata.I have the same qustion in another forom .please look at this link for that question [here is the link]: How to show sqlite datas in a textview?
Please help me to do this.
Thanks.

Instead of doing
bible *jesus = (bible *)[appDelegate.biblearray objectAtIndex:indexPath.row];
use string variable or the type of value that biblearray contains
NSString *str = [appDelegate.biblearray objectAtIndex:indexPath.row];
For only displaying in textview, you dont need to use class object jesus.

Related

Displaying JSON Object in UITableView Cell - App Crashes

I'm loading a json file from my server which have several fields like id,category,value,price.i tried SBJSON library files. If i'm trying to display single content in a cell i'm using the following code
cell.textLabel.text=[[mutarray objectAtIndex:indexPath.row] valueForKey: #"id"];
but if i need to display all the field like id,category,value in each cell.i'm not aware of that.Kindly guide me..
here mutarray is my NSMutableArray which contains all elements of my json file..
You will need to put custom cells. Please check the link below and tell me if any doubts.
Putting Custom Cells in Table View
i done that using following code
cell.textlabel.text=[[NSString stringWithFormat:#"%#",[[mutarray objectAtIndex:indexPath.row] valueForKey: #"id"]];
The issue is i forgot to convert the JSON Object into NSSTring

how to display data from a NSMutablearray in a Table View

I'm trying to initialize a tableview with an image, name and surname of each user that I have stored in a NSMutableArray.
In this mutablearray I save a class that I created to store users data and its schema is as follows:
ResultSearchController{
NSInteger *userID;
NSString *userName;
NSString *userSurname;
NSString *userThumb;
}
I have read the documentation of TableView but I still have doubts and problems to display the data in TableView (seems rather complicated to use such objects). Could you help me to get started with this?
Thanks!!
I guess you have a Custom UITableViewCell for that.
Simply use in cellForRowAtIndexPath delegate of UITableView (to set the image):-
yourCustomCellObject.yourImageViewINCustCell.image=[UIImage imageNamed:[(yourClassToStoreData *)[yourNSMutableArray objectAtIndex:indexPath.row] userThumb]];
Similarly you can do in the same manner to set other control elements.
It's just an example of how you can do.I am assuming you have stored the data over some class objects and adding it to an NSMtableArray.

Next Item in Plist Button

Hey guys, i have a simple app just a load of images in one image view. Each is just included in a plist file and called when a cell is selected in popover window. All i want is a button with an action to get next item in plist and display in the image window. this sounds easy but i cant figure out the code to grab next item in plist? can anyone help cheers
I'm not sure what the structure of your property list is, but I'm just going to guess that it's just a property list with one string containing the image name per row. The easiest way to manage this is to just dump the plist file into an array like this:
// Load the data
NSString *pathToFile = [[NSBundle mainBundle] pathForResource:someArrayNameString ofType:#"plist"];
self.someArrayYouCreated = [NSArray arrayWithContentsOfFile:pathToFile];
then you can access the data in the array like this:
// load it into some string you created
nextImageNameString = [someArrayYouCreated objectAtIndex:nextImageNumberHere];
and then you can just use that string name as the next image to load. So basically,
Dump plist into an array
Use objectAtIndex to access the images (remember, arrays start at index 0)

how can I copy a string displayed in a UITableViewCell into another NSString?

I am writing a program, and one part of my program has a UItableView in which I set cell contents manually by using the following...
cell.textLabel.text = #"CELL CONTENTS HERE!";
How can I copy a string displayed in a particular TableView Cell into another NSString?
Try something like this:
NSString *anotherString = [NSString stringWithString:cell.textLabel.text];
Keep your #"CELL CONTENTS HERE!" string as a #property of your view controller. Then set the cell's text property to it:
cell.textLabel.text = cellContentsHereProperty;
inside the table view delegate method -tableView:cellForRowAtIndexPath:. You want to do this because you can only access cell.textLabel.text inside this method, or by calling the delegate method to retrieve the cell, which is awkward.
As a general concept, you want your view controller ("control") to keep the string value ("model") separate from how it is displayed ("view"). Keeping things compartmentalized lets you retrieve and change the data without worrying about how it is displayed.
This separation of responsibilities is called the MVC or Model-View-Control design pattern, which Apple subscribes to for iPhone application design.

Custom iPad 10-key popover possible

and thanks for your responses in advance.
I have been looking around for the possibility of having a 10-key, numeric only, input available when a user clicks on certain fields that do not require the use of the full size keyboard.
I know that popovers can properly display custom types of input, but does anyone know if there is a way for a standard 10-keypad to display in a popover? And if so, can you point me in the right direction.
Again, thanks in advance.
-Rick
You don't need to use popover if you try to enter numeric value in a UITextField/UITextView.
You can replace the keyboard by your own view.
You just do :
[yourTextField setInputView:myInputView];
You can have a look at KeyboardAccessory sample from apple
http://developer.apple.com/iphone/library/samplecode/KeyboardAccessory/Introduction/Intro.html
In this example, they provide an accessory view to the input view but if you modify the code and set inputView instead of inputViewAccessory, you should be able to do what you need.
If you use a UITextView, you can append text where the carret is with the following code:
NSMutableString *text = [textView.text mutableCopy];
NSRange selectedRange = textView.selectedRange;
[text replaceCharactersInRange:selectedRange withString:#"\n"];
textView.text = text;
If you use a UITextField, it seems you can only append text at the end of the string (no mean to retrieve carret position).