IBAction doneButtonDidPress id sender MK_Log MKAddNPAddressViewCo ntro

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
-(IBAction)doneButtonDidPress:(id)sender
{
MK_Log;
MKAddNPAddressViewControllerFormFields emptyFields=[self emptyFields];
if (emptyFields!=MKAddNPAddressViewControllerFormFieldNone)
{
NSLog(@"%@: %@ called. emptyFields: %@", NSStringFromClass([self class]), NSStringFromSelector(_cmd), [NSString stringWithBitMask:(emptyFields)]);
NSString *messageStr=@"Необходимо заполнить ";
if (emptyFields & MKAddNPAddressViewControllerFormFieldName)
{
messageStr=[messageStr stringByAppendingString:@"имя, "];
};
if (emptyFields & MKAddNPAddressViewControllerFormFieldSurname)
{
messageStr=[messageStr stringByAppendingString:@"фамилию, "];
};
if (emptyFields & MKAddNPAddressViewControllerFormFieldPhone)
{
messageStr=[messageStr stringByAppendingString:@"телефон, "];
};
if (emptyFields & MKAddNPAddressViewControllerFormFieldRegion)
{
messageStr=[messageStr stringByAppendingString:@"регион, "];
};
if (emptyFields & MKAddNPAddressViewControllerFormFieldCity)
{
messageStr=[messageStr stringByAppendingString:@"город, "];
};
if (emptyFields & MKAddNPAddressViewControllerFormFieldDepartment)
{
messageStr=[messageStr stringByAppendingString:@"отделение, "];
};
messageStr=[messageStr stringByPaddingToLength:(messageStr.length-2) withString:@"" startingAtIndex:0];
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Внимание" message:messageStr delegate:nil cancelButtonTitle:@"Ок" otherButtonTitles: nil];
[alert show];
}
else
{
[self saveData];
};
}