Here "app.arrTest" is an array ,which is declared in app delegate.

class_8.h
#import <UIKit/UIKit.h>
#import "HotelAppDelegate.h"
@interface class_8 : UIViewController<UISearchBarDelegate,UITableViewDelegate, UITableViewDataSource>
HotelAppDelegate *app;
UISearchBar *searchBar;
BOOL searching;
NSMutableArray *arrAfterSearch;
UITableView *table;
-(void)search;
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)search1;
- (void)searchBarSearchButtonClicked:(UISearchBar *)search1;
- (void)searchBarCancelButtonClicked:(UISearchBar *)search1;
- (void) searchBarTextDidBeginEditing:(UISearchBar *)theSearchBar;
- (void)searchBar:(UISearchBar *)theSearchBar textDidChange:(NSString *)searchText;
@end
class_8.m
#import "class_8.h"
@implementation class_8
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title=@" Room On !";
app=(HotelAppDelegate *)[[UIApplication sharedApplication]delegate];
searching=NO;
arrAfterSearch=[[NSMutableArray alloc]init];
searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0,0,320,40)];
searchBar.barStyle=UIBarStyleBlackOpaque;
searchBar.text=@"";
searchBar.delegate = self;
searchBar.showsCancelButton = YES;
searchBar.keyboardType=UIReturnKeySearch;
searchBar.tintColor=[UIColor colorWithRed:110.0/255 green:133.0/255 blue:167.0/255 alpha:0.9];
[self.view addSubview:searchBar];
table=[[UITableView alloc] initWithFrame:CGRectMake(0, 40, 320, 480) style:UITableViewStyleGrouped];
table.delegate=self;
table.dataSource=self;
[self.view addSubview:table];
////////search/////////////
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)search1
[search1 setShowsCancelButton:YES animated:YES];
return YES;
- (void)searchBarSearchButtonClicked:(UISearchBar *)search1
[search1 setShowsCancelButton:NO animated:YES];
[search1 resignFirstResponder];
- (void)searchBarCancelButtonClicked:(UISearchBar *)search1
[search1 setShowsCancelButton:NO animated:YES];
[search1 resignFirstResponder];
- (void) searchBarTextDidBeginEditing:(UISearchBar *)theSearchBar
if(searching)
return;
else
searching = NO;
- (void)searchBar:(UISearchBar *)theSearchBar textDidChange:(NSString *)searchText
[arrAfterSearch removeAllObjects];
if([searchText length] > 0)
searching = YES;
[self search];
else
searching = NO;
[table reloadData];
-(void)search
NSString *searchText = searchBar.text;
NSInteger len=searchText.length;
NSMutableArray *searchArray = [[NSMutableArray alloc] init];
for(int i=0;i<[app.arrTest count];i++)
[searchArray addObject:[[app.arrTest objectAtIndex:3]objectAtIndex:i]];
NSLog(@"search array %@",searchArray);
for(int i=0;i<[searchArray count];i++)
NSString *name=[searchArray objectAtIndex:i];
if(name.length<len)
continue;
NSString *str=[name substringToIndex:len];
if([searchText caseInsensitiveCompare:str]==0)
[arrAfterSearch addObject:[[app.arrTest objectAtIndex:3]objectAtIndex:i]];
NSLog(@"arrAfterSearch array %@",arrAfterSearch);
[searchArray release];
searchArray = nil;
/////////end search//////////
/////table////////
- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section
if (searching==YES)
return [arrAfterSearch count];
else
return [app.arrTest count];
-(CGFloat)tableView:(UITableView*)table1 heightForRowAtIndexPath:(NSIndexPath*)indexpath
return 40;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
static NSString *CellIdentifier = @"Cell";
static NSString *CellIdentifier1 = @"Cell1";
UITableViewCell *cell;
if(cell==nil)
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
else
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier1] autorelease];
UILabel *lbl =[[UILabel alloc]init];
lbl.frame=CGRectMake(0, 0, 320, 30);
lbl.backgroundColor=[UIColor clearColor];
lbl.font = [UIFont fontWithName:@"Arial" size:12.0];
if (searching==YES)
NSMutableString * str1 = [arrAfterSearch objectAtIndex:indexPath.row];
lbl.text=str1;
else
NSMutableString * str1 = [[app.arrTest objectAtIndex:2]objectAtIndex:indexPath.row];
lbl.text=str1;
[cell.contentView addSubview:lbl];
[lbl release],lbl=nil;
return cell;
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
return 1;
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
////////end table//////////
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
- (void)dealloc {
[super dealloc];
@end

You need the developer forums: http://devforums.apple.com

Similar Messages

  • How to return a array which be created in native method?

    i wrote my native method like this:
    jintarray array=env->Newintarray(10);
    jint* p=env->GetIntArrayElements(array,0);
    for(int i=0;i<10;i++){
    p=i;
    return array;
    the result is that i got a array which has ten elements and all the elements are 0.
    it seems the value of the array never be chenged.
    how can i do? where is the mistake? how can i get the correct result?

    Not quite clear what you are trying to do.
    o You create a java in array, which will be initialized to zeroes.
    o You then asked to access that array (as p), but you didn't pass a pointer to a boolean so it can tell you whether p points into the java array, or is a separate memory area.
    o You assigned a bunch of int values to p - not p[0], p [1], ....?
    o You returned to java the original array.
    Here's some (untested) code that will likely work:
    jBoolean isCopy;
    jintarray array=env->Newintarray(10);
    jint* p=env->GetIntArrayElements(array,&isCopy);
    for(int i=0;i<10;i++){
    p=i;
    if (isCopy == JNI_TRUE)
    env->ReleaseIntArrayElements(array, p, 0);
    return array;

  • Can I sync my ipad with my wifes itunes and download her apps in addition to mine?

    I would like to add applications from my itunes and my wifes itunes account to my ipad 2.  Is that possible?

    Contrary to the 2 above comments, iTunes content acquired from the iTunes Store can be shared with 5 other authorized computers. You may only sync an iOS device to one iTunes account, but you can share the content acquired by one iTunes Store account with other iOS devices.
    The first thing that you and your wife need to do is to open iTunes and go to Preferences/Devices and check the box for Prevent iPods, iPhones and iPads from syncing automatically. Now you have control of your iOS device when it is connected to the other's account.
    If you want the apps from your wife's iPad, connect the iPad to the computer and iTunes app to which you sync your iPad. Control click or right click her iPad's name in the iTunes devices list in the left column and choose Transfer Purchases. All purchased iTunes content on her iPad will by transfered to your iTunes account. After the transfer is complete, detatch her iPad and go to Authrize This Computer in the iTunes Store menu. Enter her Apple ID and password for her iTunes Store account and Authorize. Now all of her content is available to you and any iOS device which you sync to your iTunes account. You can do the same in reverse with your iPad for her.
    The one thing to remember is that these are still her apps or your apps. So these apps can only be updated with the account that acquired them. If you open iTunes and see that there are apps with updates, to update your apps log into your iTunes Store account. To update her apps, log into her iTunes Store account. If you see apps to update but after logging into your iTunes Store account you are told there are no updates for you, then you know that the apps that have updates are hers.

  • Can I move my daughter off my account by creating a new one for her and have all her apps/data/music/etc. move to her new account?

    I want to split off my daughter from my apple account and set up her own.  Once she has her own account she would like to have her apps/data/music, etc. on her iPhone and iPad under the new account as it was under mine.  Can I set her up a separate account and then move her apps/data/music, etc., to her new account?  If so how do we do this and what are the dangers/pifalls of doing this (if any)?

    You can migrate her to a separate iCoud account if you want, but existing purchased media (apps, music, etc.) will still be tied to the existing ID.  Purchased media is permanently tied to the ID used to purchase them.
    If you want to move her to a separate iCloud account, you can do that and still continue to share the same ID for iTunes purchases.  The ID you use for iTunes does not have to be the same as the one you use for iCloud.  To do this, start by saving any photo stream photos she wants to keep to your camera roll (unless already there) by opening your my photo stream album, tapping Select, tapping the photos, tap the share icon (box with upward facing arrow, then tapping Save to Camera Roll.  If she is syncing notes with iCloud, you'll need to open each of your notes and email them to her so she can later copy and paste the text into new notes created in her new account.  Then go to Settings>iCloud, tap Delete Account (which only deletes it from this device, not from iCloud; your devices will not be effected by this), choose Keep on My iDevice and provide the password when prompted.  Then sign back in with a different Apple ID to create your her account and choose Merge to upload the data.
    Once you are both on separate accounts, you can each go to icloud.com and delete the other person's data from your account.

  • Nokia HERE apps for Windows Phone 7.8

    Today Nokia released the HERE apps for the entire Windows Phone 8 family, that means, Nokia Lumia devices and HTC/Samsung/Huawei devices too. A few weeks ago it was even launched for iOS devices, that's iPhone. I've even heard that you people are working on porting those apps to Android. Now... why aren't Windows Phone 7.8 users like me stuck in the dark with no HERE apps? I currently have a Samsung Focus v1.3 which barely runs the integrated maps app, but honestly it sucks. I would love if Nokia could give us WP7.8 users some love, at least with the basic Maps app specially to have offline maps. Drive would be nice too, but it's not a really big deal to keep this devices "alive" for a couple of months. Currently my wife has a Lumia 800 and of course she's happy with it, looking forward to change it for a Lumia 920 when it arrives to her carrier, but since I use a prepaid line for better economy I'm not able to opt for a change and I'll have to stick with the Focus for a while as I can get a Lumia 920. So please, just think about it, I'm a developer for the platform, I know it's not hard to port that app for offline map catching, I realy doesn't matter if there's no 3D maps and all the navigation features, but it really would be nice and much of a need to have a decent offline maps app in Windows Phone 7.8.
    David Salazar
    Software Engineer

    Nokia Maps/drive has been made available to other OEMs to license for their devices afaik.. If Samsung or whoever choose not to that's up to them. For Windows Phone 8 this is a different story as maps is integrated much more deeply there.
    Click on the blue Star Icon below if my advice has helped you or press the 'Accept As Solution' link if I solved your problem..

  • I have just bought a mini ipad for my daughter set it up in my apple id so she could keep all her apps games etc, how do i set up a seperate account for her ipad and also keep my own id @

    I have just bought a mini ipad for my daughter and used my apple id to set it up for her so she can keep all her apps and downloads of my ipad that she was using, i was wondering how do i give her, her own apple id so that she can keep all her apps and then i can two seperate accounts ?

    You cannot transfer the purchases to another account. What she has purchased with your account will always be tied to your ID. That's the way that it works. You can have her create her own Apple ID to use with Cloud account, FaceTime and Messages.
    But if you create a new ID for her, she will have to flip flop between the two Apple ID's in order to update apps, and if she wants to make purchases with her own ID, you also have to consider the fact that she may run the risk of locking herself out of her own ID by downloading a past purchase using your ID, after she starts buying with her own ID.
    Read this about associated devices in iTunes.
    http://support.apple.com/kb/HT4627

  • My wife and I share a computer, but different Itunes accounts. How do I stop itunes from synchronising her apps to my phone

    My wife and I share a computer, but different Itunes accounts. How do I stop itunes from synchronising her apps to my phone?

    If the music is on the same computer, import the songs to your iTunes library by dragging them into iTunes or choosing File > Add to Library (Mac) or File > Add File to Library or Add Folder to Library (Windows).  If the music is on different computers you can set up Home Sharing to copy the music from one library to the other (see http://support.apple.com/kb/HT3819 and http://support.apple.com/kb/HT4620).

  • Is there an app that will allow my toddler to access or use her apps and games without being able to do other things on my iPad?

    My two year old loves to use my iPad.  She has apps for reading, shapes, counting, etc.  My problem is that when she uses my iPad, she is constantly scrolling through and changing settings or getting into other apps.  Is there an app I can download that I can turn on while she is using the iPad that will limit her access to only her apps?
    I apologize in advance but I don't know what version of the iPad I have.  It is about 2 years old. 
    Thanks.

    Such functionality is built-in: http://support.apple.com/kb/ht5509 but for single apps.

  • A friend of my daughter's used my mac when she got her new iphone.  Now I have a new iphone and my phone has her app store information on it and I don't know how to get it off and put mine in there!

    A friend of my daughter's used my mac computer when she got her new iphone to help set it up.  Now that I have a new iphone, her apps and all the app store information is stuck on my phone.  Her app account keeps showing up when I try to install something new, and I obviously do not have her password.  How do I get this off my phone??

    Open iTunes on the computer.  Without any iPhone plugged in, go to iTunes' menu and do Store > Sign Out.
    The click the iTunes Store row on the left of the iTunes display.  You can then sign on from the signon row on the right side of the display using the correct Apple ID and password.  Then you'll be all set!

  • HT1495 My wife and I both have iPhone 4 we have different apps and music as well have different iTunes accounts but we share same computer when we update our phones to iTunes it gives me her apps and stuff on my phone is there way to prevent this

    My wife and I only have one computer but we each have iPhone 4 everytime either of us update our phones it gives me her apps and visa versa we do make sure we sign in our iTunes account first is anything can do to prevent that from occuring

    Also, make sure you have "Home Saring: on your computer's iTunes and all devices turned off.
    Setting up Home Sharing on your computer
    http://support.apple.com/kb/HT4620
    Setting up Home Sharing on your device
    http://support.apple.com/kb/HT4557

  • My girlfriend just bought a new iphone and needs me to help from home with her apps.  How can i see them? When I log in i see my apps and my music

    My girlfriend needs me to log in to itunes to help her w her apps. but when i do all i see are mine. i am logged into her acct???

    Welcome to the Apple Community.
    You can't keep swapping iTunes accounts to use other people's apps or you will locked out of changing back to your own account. I'm not sure how you can help her with her apps from another device.

  • How to pass an array which in the jsp to a javascript file

    now i have 2 files: jsp and js(javascript)
    i want pass an array which in the jsp to another file--> js file
    how can i do it ???
    can u give me some related links or some source codes as the references???
    thx

    bcos ....my senior has resigned!!! so i take over his job !!!!!
    depend on the talent and the project ....only that way to implement to whole project !!!!
    but , i had settled it already ....
    it is very simple
    in the middle.jsp
    Collection result = menuManager.getUserRoleMenu(webSessionUser.getGnuserId());
    String menuname[]=new String[110];
    int menucounter=0;
    Iterator vi = result.iterator();
    while(vi.hasNext())
    HashMap hm=(HashMap)vi.next();
    menuname[menucounter]=hm.toString();
    menucounter++;
    int i;
    String tempstr="";
    for(i=0;i<menuname.length;i++)
    tempstr+=menuname[i]+",";
    session.setAttribute("menuname",tempstr);
    %>
    <script language="javascript">
    menu123("<%=tempstr %>");
    </script>
    in the body,js
    function menu123(string123)
    //doing
    so ....through the script --menu123
    i can get the string from jsp to the js!!!!!
    is it very simple, but it spends my 2 days!!!
    i just learn javascript ....about 1 month !!!

  • HT4137 I recently bought an ipad off someone with her apps. i want to add apps from my account with out lossing the apps she has. please help

    i recently bought a used ipad with apps from someone.  I want to down load my apps on to it with out lossing her apps. how can this be done?

    You can download whatever you want by signing into your own account, but what ever was previously installed with the other account will be forever associated with that account. This will work until the apps that aren't yours need updating and the only way to update them will be to sign in with other I'd.

  • Somehow my wife has ended up with some of my apps on her iPhone, and I have some of her apps on my iPhone.  So, when I update apps on my phone, some of them ask me for her apple ID password. How do I get her apps off my phone.

    Somehow my wife has ended up with some of my apps on her iPhone, and I have some of her apps on my iPhone.  So, when I update apps on my phone, some of them ask me for her apple ID password. How do I get her apps off my phone.

    Do you guys use the same computer with itunes on it? And the best way to get them off is to go into the Setting>Itunes & App Store and sign out of her appleid if it's listed there. Also just delete all of the apps from her appleid off your phone.

  • Counting number of elements in an array which aren't empty?

    i tried using this method to count an array which has 100 elements but it doesn't go past the while statement which i cant figure out?
    public static void countCust()
    int cntr = 0;
    int z;
    for (int c = 0; c < 100; c++)
    while (customer[c].indexOf(':') != -1)
    cntr++;
    javax.swing.JOptionPane.showMessageDialog(null, "There are " + cntr + " customers on record");
    }

    Are you getting NullPointerExceptions?
    Are you sure customer[] has been allocated?
    Are you sure each element in the array is non-null?
    BTW, it's traditional to use variables in loops that are closer to their mathematical usage. I mean, for an array index, usually you'd use variables named i or j, unless the indices map to coordinates in space, in which case you'd use x, y, and z.
    If neither of these is applicable, use a variable with a more meaningful name.

Maybe you are looking for

  • Cannot open CR2 files in Elements 8 or Bridge

    Hi, I hope someone can help me! I shoot in RAW, and have always edited my pictures in Camera RAW via Elements 8. I recently upgraded my old Dell to a new Mac, and now I'm having trouble. I cannot seem to open the RAW files in Elements, this is what I

  • Use of substr function will avoid the use of indexes in a table

    i have one table which will contain some 3,00,000 records, it contains some 11 primary keys i am using some update statements to update some fields in the records (of 3,00,000 i will compare some 1,50,000 records with 1,50,000 another records) i am u

  • Need help on how to code this SQL statement! (one key has leading zeros)

    Good day, everyone! First of all, I apologize if this isn't the best forum.  I thought of putting it in the SAP Oracle database forum, but the messages there seemed to be geared outside of ABAP SELECTs and programming.  Here's my question: I would li

  • GATP: ATP bucket assignment for supply elements - how to use BucketLogic ?

    Hello experts, I have a little issue with applying correct bucket logic - hoping somebody has a hint for me on this. My case: I have a PurchaseOrder coming in on Date_X, Time 00:00 in R3 --> same day and time in Product view in APO I have a Productio

  • WPC and UWL

    When creating the approval process for WPC approval tasks are routed to the UWL.  However when the user clicks the item to be reviewed or Selects "Display Item" - the content to be approved is displayed in XML. However my content managers don't under