Sviluppo #3
@ -4,6 +4,7 @@ use_frameworks!
|
|||||||
inhibit_all_warnings!
|
inhibit_all_warnings!
|
||||||
pod 'PureLayout'
|
pod 'PureLayout'
|
||||||
pod 'pop', '~> 1.0'
|
pod 'pop', '~> 1.0'
|
||||||
|
pod 'UIView-Overlay'
|
||||||
pod 'UIActionSheet-Blocks'
|
pod 'UIActionSheet-Blocks'
|
||||||
pod 'UIAlertViewBlockExtension'
|
pod 'UIAlertViewBlockExtension'
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
TabBarSubItem *subItem6 = [TabBarSubItem tabBarSubItemWithName:@"Peppe5" andValue:@"Peppe5"];
|
TabBarSubItem *subItem6 = [TabBarSubItem tabBarSubItemWithName:@"Peppe5" andValue:@"Peppe5"];
|
||||||
TabBarSubItem *subItem7 = [TabBarSubItem tabBarSubItemWithName:@"Peppe6" andValue:@"Peppe6"];
|
TabBarSubItem *subItem7 = [TabBarSubItem tabBarSubItemWithName:@"Peppe6" andValue:@"Peppe6"];
|
||||||
|
|
||||||
TabBarPickerSubItemsView *locationSubview = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:YES];
|
TabBarPickerSubItemsView *locationSubview = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeDistance subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:YES];
|
||||||
|
|
||||||
TabBarItem *location = [[TabBarItem alloc] initWithSubItemView:locationSubview];
|
TabBarItem *location = [[TabBarItem alloc] initWithSubItemView:locationSubview];
|
||||||
[location setItemName:@"Location"];
|
[location setItemName:@"Location"];
|
||||||
@ -40,7 +40,7 @@
|
|||||||
[location setSelectedImage:[UIImage imageNamed:@"location_selected"]];
|
[location setSelectedImage:[UIImage imageNamed:@"location_selected"]];
|
||||||
[location setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
|
[location setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
|
||||||
|
|
||||||
TabBarPickerSubItemsView *locationSubview1 = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:NO];
|
TabBarPickerSubItemsView *locationSubview1 = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeDateAndTime subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:NO];
|
||||||
|
|
||||||
TabBarItem *location1 = [[TabBarItem alloc] initWithSubItemView:locationSubview1];
|
TabBarItem *location1 = [[TabBarItem alloc] initWithSubItemView:locationSubview1];
|
||||||
[location1 setItemName:@"Location2"];
|
[location1 setItemName:@"Location2"];
|
||||||
@ -48,7 +48,7 @@
|
|||||||
[location1 setSelectedImage:[UIImage imageNamed:@"location_selected"]];
|
[location1 setSelectedImage:[UIImage imageNamed:@"location_selected"]];
|
||||||
[location1 setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
|
[location1 setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
|
||||||
|
|
||||||
TabBarPickerSubItemsView *locationSubview2 = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:NO];
|
TabBarPickerSubItemsView *locationSubview2 = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeCheckBox subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:NO];
|
||||||
|
|
||||||
TabBarItem *location2 = [[TabBarItem alloc] initWithSubItemView:locationSubview2];
|
TabBarItem *location2 = [[TabBarItem alloc] initWithSubItemView:locationSubview2];
|
||||||
[location2 setItemName:@"Location3"];
|
[location2 setItemName:@"Location3"];
|
||||||
@ -56,7 +56,7 @@
|
|||||||
[location2 setSelectedImage:[UIImage imageNamed:@"location_selected"]];
|
[location2 setSelectedImage:[UIImage imageNamed:@"location_selected"]];
|
||||||
[location2 setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
|
[location2 setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
|
||||||
|
|
||||||
TabBarPickerSubItemsView *locationSubview3 = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:NO];
|
TabBarPickerSubItemsView *locationSubview3 = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypePrice subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:NO];
|
||||||
|
|
||||||
TabBarItem *location3 = [[TabBarItem alloc] initWithSubItemView:locationSubview3];
|
TabBarItem *location3 = [[TabBarItem alloc] initWithSubItemView:locationSubview3];
|
||||||
[location3 setItemName:@"Location4"];
|
[location3 setItemName:@"Location4"];
|
||||||
@ -64,7 +64,7 @@
|
|||||||
[location3 setSelectedImage:[UIImage imageNamed:@"location_selected"]];
|
[location3 setSelectedImage:[UIImage imageNamed:@"location_selected"]];
|
||||||
[location3 setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
|
[location3 setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
|
||||||
|
|
||||||
TabBarPickerSubItemsView *locationSubview4 = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:NO];
|
TabBarPickerSubItemsView *locationSubview4 = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButton subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:NO];
|
||||||
|
|
||||||
TabBarItem *location4 = [[TabBarItem alloc] initWithSubItemView:locationSubview4];
|
TabBarItem *location4 = [[TabBarItem alloc] initWithSubItemView:locationSubview4];
|
||||||
[location4 setItemName:@"Location5"];
|
[location4 setItemName:@"Location5"];
|
||||||
|
|||||||
@ -379,6 +379,12 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
|
||||||
|
#pragma mark TabBarPickerSubItemsViewDataSource
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
#pragma mark TabBarItemDelegate
|
#pragma mark TabBarItemDelegate
|
||||||
|
|||||||
@ -14,10 +14,11 @@
|
|||||||
|
|
||||||
typedef NS_ENUM(NSInteger, TabBarPickerSubItemsViewType) {
|
typedef NS_ENUM(NSInteger, TabBarPickerSubItemsViewType) {
|
||||||
// Informational
|
// Informational
|
||||||
TabBarPickerSubItemsViewTypeData,
|
TabBarPickerSubItemsViewTypeDistance,
|
||||||
TabBarPickerSubItemsViewTypeString,
|
TabBarPickerSubItemsViewTypeDateAndTime,
|
||||||
TabBarPickerSubItemsViewTypeButtons,
|
TabBarPickerSubItemsViewTypePrice,
|
||||||
TabBarPickerSubItemsViewTypeCheckBox
|
TabBarPickerSubItemsViewTypeCheckBox,
|
||||||
|
TabBarPickerSubItemsViewTypeButton,
|
||||||
};
|
};
|
||||||
|
|
||||||
@protocol TabBarPickerSubItemsViewDelegate <NSObject>
|
@protocol TabBarPickerSubItemsViewDelegate <NSObject>
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
#import "SharedLocationManager.h"
|
#import "SharedLocationManager.h"
|
||||||
#import "UIAlertView+BlockExtension.h"
|
#import "UIAlertView+BlockExtension.h"
|
||||||
|
|
||||||
@interface TabBarPickerSubItemsView()
|
@interface TabBarPickerSubItemsView() <UIPickerViewDataSource,UIPickerViewDelegate>
|
||||||
|
|
||||||
@property (nonatomic, assign) BOOL didSetupConstraints;
|
@property (nonatomic, assign) BOOL didSetupConstraints;
|
||||||
@property (nonatomic) TabBarPickerSubItemsViewType type;
|
@property (nonatomic) TabBarPickerSubItemsViewType type;
|
||||||
@ -25,6 +25,10 @@
|
|||||||
@property (nonatomic, strong) UIView *contentView;
|
@property (nonatomic, strong) UIView *contentView;
|
||||||
@property (nonatomic, strong) NSString *name;
|
@property (nonatomic, strong) NSString *name;
|
||||||
|
|
||||||
|
@property (nonatomic, strong) UIView *HUD;
|
||||||
|
@property (nonatomic, strong) UIPickerView *pickerView;
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation TabBarPickerSubItemsView
|
@implementation TabBarPickerSubItemsView
|
||||||
@ -39,6 +43,15 @@
|
|||||||
|
|
||||||
if (self) {
|
if (self) {
|
||||||
[self setUserInteractionEnabled:YES];
|
[self setUserInteractionEnabled:YES];
|
||||||
|
|
||||||
|
_subItems = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
|
for (NSObject *subItem in subItems) {
|
||||||
|
if ([subItem isKindOfClass:[TabBarSubItem class]]) {
|
||||||
|
[_subItems addObject:subItem];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_type = type;
|
_type = type;
|
||||||
_needsLocalization = needsLocalization;
|
_needsLocalization = needsLocalization;
|
||||||
_switchBarView = [[UIView alloc] initForAutoLayout];
|
_switchBarView = [[UIView alloc] initForAutoLayout];
|
||||||
@ -62,6 +75,40 @@
|
|||||||
|
|
||||||
[self addSubview:_contentView];
|
[self addSubview:_contentView];
|
||||||
|
|
||||||
|
_HUD = [[UIView alloc] initForAutoLayout];
|
||||||
|
[_HUD setAlpha:0];
|
||||||
|
[_HUD setBackgroundColor:[[UIColor whiteColor] colorWithAlphaComponent:0.25]];
|
||||||
|
|
||||||
|
[_contentView addSubview:_HUD];
|
||||||
|
|
||||||
|
|
||||||
|
switch (_type) {
|
||||||
|
case TabBarPickerSubItemsViewTypeDateAndTime: {
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TabBarPickerSubItemsViewTypeCheckBox: {
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TabBarPickerSubItemsViewTypeDistance: {
|
||||||
|
_pickerView = [[UIPickerView alloc] initForAutoLayout];
|
||||||
|
[_pickerView setDelegate:self];
|
||||||
|
[_pickerView setDataSource:self];
|
||||||
|
|
||||||
|
[_contentView addSubview:_pickerView];
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TabBarPickerSubItemsViewTypePrice: {
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_needsLocalization) {
|
if (_needsLocalization) {
|
||||||
|
|
||||||
_localizationView = [[UIView alloc] initForAutoLayout];
|
_localizationView = [[UIView alloc] initForAutoLayout];
|
||||||
@ -96,11 +143,21 @@
|
|||||||
|
|
||||||
- (void) layoutSubviews {
|
- (void) layoutSubviews {
|
||||||
|
|
||||||
|
//NSAssert(_dataSource, @"TabBarPickerSubItemsView needs datasource");
|
||||||
|
|
||||||
|
if (_needsLocalization) {
|
||||||
|
|
||||||
[UIView animateWithDuration:0.5 animations:^{
|
[UIView animateWithDuration:0.5 animations:^{
|
||||||
[_localizationView setAlpha:[[NSNumber numberWithBool:[[SharedLocationManager sharedManager] localizationIsAuthorized]] floatValue]];
|
[_localizationView setAlpha:[[NSNumber numberWithBool:![[SharedLocationManager sharedManager] localizationIsAuthorized]] floatValue]];
|
||||||
[_itemSwich setUserInteractionEnabled:NO];
|
if ([[SharedLocationManager sharedManager] localizationIsAuthorized]) {
|
||||||
[_itemSwich setOn:NO];
|
[_itemSwich setUserInteractionEnabled:[[SharedLocationManager sharedManager] localizationIsAuthorized]];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
[_itemSwich setUserInteractionEnabled:[[SharedLocationManager sharedManager] localizationIsAuthorized]];
|
||||||
|
[_itemSwich setOn:[[SharedLocationManager sharedManager] localizationIsAuthorized]];
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
if (!_didSetupConstraints) {
|
if (!_didSetupConstraints) {
|
||||||
|
|
||||||
@ -123,6 +180,11 @@
|
|||||||
[_contentView autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:self];
|
[_contentView autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:self];
|
||||||
[_contentView autoAlignAxisToSuperviewAxis:ALAxisVertical];
|
[_contentView autoAlignAxisToSuperviewAxis:ALAxisVertical];
|
||||||
|
|
||||||
|
[_HUD autoMatchDimension:ALDimensionWidth toDimension:ALDimensionWidth ofView:_contentView];
|
||||||
|
[_HUD autoMatchDimension:ALDimensionHeight toDimension:ALDimensionHeight ofView:_contentView];
|
||||||
|
[_HUD autoAlignAxisToSuperviewAxis:ALAxisVertical];
|
||||||
|
[_HUD autoPinEdge:ALEdgeTop toEdge:ALEdgeTop ofView:_contentView];
|
||||||
|
|
||||||
if (_needsLocalization) {
|
if (_needsLocalization) {
|
||||||
|
|
||||||
[_localizationView autoPinEdge:ALEdgeTop toEdge:ALEdgeTop ofView:_contentView];
|
[_localizationView autoPinEdge:ALEdgeTop toEdge:ALEdgeTop ofView:_contentView];
|
||||||
@ -136,6 +198,7 @@
|
|||||||
[_localizationButton autoSetDimension:ALDimensionHeight toSize:44 relation:NSLayoutRelationLessThanOrEqual];
|
[_localizationButton autoSetDimension:ALDimensionHeight toSize:44 relation:NSLayoutRelationLessThanOrEqual];
|
||||||
[_localizationButton autoMatchDimension:ALDimensionWidth toDimension:ALDimensionWidth ofView:self withMultiplier:0.8];
|
[_localizationButton autoMatchDimension:ALDimensionWidth toDimension:ALDimensionWidth ofView:self withMultiplier:0.8];
|
||||||
}
|
}
|
||||||
|
|
||||||
_didSetupConstraints = YES;
|
_didSetupConstraints = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,12 +235,13 @@
|
|||||||
|
|
||||||
- (void)changeSwitch:(UISwitch*)sender{
|
- (void)changeSwitch:(UISwitch*)sender{
|
||||||
|
|
||||||
|
[_HUD setAlpha:[[NSNumber numberWithBool:![sender isOn]] floatValue]];
|
||||||
if([sender isOn]){
|
if([sender isOn]){
|
||||||
NSLog(@"Switch is ON");
|
NSLog(@"Switch is ON");
|
||||||
|
|
||||||
} else{
|
} else{
|
||||||
NSLog(@"Switch is OFF");
|
NSLog(@"Switch is OFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event
|
- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event
|
||||||
@ -194,4 +258,49 @@
|
|||||||
[_switchBarLabel setText:itemName];
|
[_switchBarLabel setText:itemName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark UIPickerViewDataSource
|
||||||
|
|
||||||
|
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
|
||||||
|
if ([_subItems count] > 0) {
|
||||||
|
[(TabBarSubItem*)[_subItems firstObject] numberOfValues];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns the # of rows in each component..
|
||||||
|
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
|
||||||
|
#pragma mark UIPickerViewDelegate
|
||||||
|
|
||||||
|
/*
|
||||||
|
- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component {
|
||||||
|
|
||||||
|
}
|
||||||
|
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -12,8 +12,12 @@
|
|||||||
|
|
||||||
@property (nonatomic, strong) NSString *name;
|
@property (nonatomic, strong) NSString *name;
|
||||||
@property (nonatomic, strong) UIButton *subItemButton;
|
@property (nonatomic, strong) UIButton *subItemButton;
|
||||||
@property (nonatomic, strong) id value;
|
@property (nonatomic, strong) id firstValue;
|
||||||
|
@property (nonatomic, strong) id secondValue;
|
||||||
|
|
||||||
+ (instancetype) tabBarSubItemWithName:(NSString*)name andValue:(id) value;;
|
+ (instancetype) tabBarSubItemWithName:(NSString*)name andValue:(id) value;
|
||||||
|
|
||||||
|
+ (instancetype) tabBarSubItemWithName:(NSString*)name firstValue:(id) firstValue secondValue:(id) secondValue;
|
||||||
|
|
||||||
|
- (NSUInteger) numberOfValues;
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -19,23 +19,26 @@
|
|||||||
@implementation TabBarSubItem
|
@implementation TabBarSubItem
|
||||||
|
|
||||||
|
|
||||||
- (instancetype) initWithName:(NSString *) name andValue:(id)value {
|
- (instancetype) initWithName:(NSString *) name firstValue:(id)firstValue secondValue:(id) secondValue {
|
||||||
|
|
||||||
self = [self initForAutoLayout];
|
self = [self initForAutoLayout];
|
||||||
if (self) {
|
if (self) {
|
||||||
|
|
||||||
//[[NSNotificationCenter defaultCenter] addObserver: self selector:@selector(deviceOrientationDidChange:) name: UIDeviceOrientationDidChangeNotification object: nil];
|
|
||||||
|
|
||||||
_name = name;
|
_name = name;
|
||||||
_subItemButton = [[UIButton alloc] initForAutoLayout];
|
_subItemButton = [[UIButton alloc] initForAutoLayout];
|
||||||
[_subItemButton setTitle:_name forState:UIControlStateNormal];
|
[_subItemButton setTitle:_name forState:UIControlStateNormal];
|
||||||
_value = value;
|
_firstValue = ( firstValue ? firstValue : @"");
|
||||||
|
_secondValue = ( secondValue ? secondValue : @"");
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype) tabBarSubItemWithName:(NSString*)name andValue:(id)value {
|
+ (instancetype) tabBarSubItemWithName:(NSString*)name andValue:(id)value {
|
||||||
return [[self alloc] initWithName:name andValue:value];
|
return [[self alloc] initWithName:name firstValue:value secondValue:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (instancetype) initWithName:(NSString *) name firstValue:(id)firstValue secondValue:(id) secondValue {
|
||||||
|
return [[self alloc] initWithName:name firstValue:firstValue secondValue:secondValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setName:(NSString *)name {
|
- (void) setName:(NSString *)name {
|
||||||
@ -43,12 +46,18 @@
|
|||||||
[_subItemButton setTitle:_name forState:UIControlStateNormal];
|
[_subItemButton setTitle:_name forState:UIControlStateNormal];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSUInteger) numberOfValues {
|
||||||
|
NSUInteger response = 0;
|
||||||
|
|
||||||
- (void)deviceOrientationDidChange:(NSNotification *)notification {
|
if (_firstValue) {
|
||||||
//Obtain current device orientation
|
response++;
|
||||||
_orientation = [[UIDevice currentDevice] orientation];
|
}
|
||||||
|
|
||||||
[self layoutSubviews];
|
if (_secondValue) {
|
||||||
|
response++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) layoutSubviews {
|
- (void) layoutSubviews {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user