Попробуйте это
Update table1
Set Criteria2 = (
select max(criteria2) from table1 t1
where t1.identifier1 = table1.identifier1
and t1.identifier2 = table1.identifier2
and t1.criteria2 is not null
)
Where Criteria1 is not NULL
Вопрос 1: Объявите UIBarButtonItem *tempButton в интерфейсе
@interface MyAppDelegate : NSObject <UIApplicationDelegate> {
UIBarButtonItem *tempButton;
}
@property (nonatomic, retain) UIBarButtonItem *tempButton;
и синтезируйте его в реализации.
@synthesize tempButton;
Создайте объект в viewDidLoad, подобном тому, как Вы теперь.
- (void)viewDidLoad {
tempButtom = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"lock-unlocked.png"] style:UIBarButtonItemStylePlain target:self action:@selector(lockScreen)];
self.navigationItem.rightBarButtonItem = tempButton;
}
Но не выпускайте его здесь, выпускайте его в dealloc методе, обычно найденном внизу.
Затем, когда Lockscreen называют, делают
tempButton.image = [UIImage imageNamed:@"myImage.png"]
У меня нет ответа для вопроса 2, я боюсь!
Что касается вопроса 2, используйте свойство 'enabled':
self.navigationItem.leftBarButtonItem.enabled = NO;
I can't understand if you have a navigationController, but in this case to disable the back button you need to call:
self.navigationItem.hidesBackButton = YES;
Я не был можно отключить / затенять кнопку NavBar с помощью:
self.navigationItem.leftBarButtonItem.enabled = NO;
... но скрытие кнопки возврата работает хорошо!
self.navigationItem.hidesBackButton = YES;
Спасибо, Дзамир!
Использование "hidesBackButton = YES" на самом деле не изящное решение, потому что оно СКРЫВАЕТ кнопку, чего мы не хотим. Приемлемым обходным решением было бы добавление UILabel в окно прямо над кнопкой «Назад», по крайней мере, отключение касаний к кнопке.
Добавьте этот метод в свой класс AppDelegate:
- (void) disableLeftBarButtonItemOnNavbar:(BOOL)disable
{
static UILabel *l = nil;
if (disable) {
if (l != nil)
return;
l = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, 160, 44)];
l.backgroundColor = [UIColor clearColor];
l.userInteractionEnabled = YES;
[self.window addSubview:l];
}
else {
if (l == nil)
return;
[l removeFromSuperview];
[l release];
l = nil;
}
}
Вы можете вызвать его следующим образом из любого контроллера представления, чтобы отключить:
MyAppDelegate *appDeleg = (MyAppDelegate *) [[UIApplication sharedApplication] delegate];
[appDeleg disableLeftBarButtonItemOnNavbar:YES];
Чтобы включить:
MyAppDelegate *appDeleg = (MyAppDelegate *) [[UIApplication sharedApplication] delegate];
[appDeleg disableLeftBarButtonItemOnNavbar:NO];