Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use a bool variable in objective c

I am currently trying to use a boolean to check for when an event happens.. However I'm not sure how to use a boolean value in objective c

Heres what I'm doing.

//.h

BOOL *removeActivityIndicator;
//..
@property (nonatomic, assign) BOOL *removeActivityIndicator;

//.m

if ([filteredArray count] == 0)
        {
            self.removeActivityIndicator = YES;
        }
        else if([filteredArray count] !=0)
        {
            tempArray = filteredArray;
        }
}

So I'm checking if the filtered array has no values if thats the case then I want to stop my UIActivityIndicator thats Is currently running in my uitableview cell.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//...

//Stop ActivityIndicator if arrays have no values for the user
    if(indexPath.section == 0)
    {        
        if ((indexPath.row == 1) && (self.removeActivityIndicator == 0)) //problem
        {
            //Stop activity indicators
            //[activityView stopAnimating];
            cell.accessoryView = nil;//replaces activity indicator
        }
    }

//...

My problem happens in the if parameters..

(self.removeActivityIndicator == 0)

I have no idea how to check if the BOOL is true or not.

any help would be greatly appreciated.

like image 472
C.Johns Avatar asked Jan 18 '23 04:01

C.Johns


1 Answers

in objective c true and false are YES and NO. Or, you can use this code:

if (!self.removeActivityIndicator) {}; 

it means

if (self.removeActivityIndicator == NO) {}; 

offcorse, removeActivityIndicator must be BOOL type

like image 137
SentineL Avatar answered Jan 24 '23 22:01

SentineL