在我的应用程序中,我想在一个视图控制器中处理两个分段控制器。 到目前为止我创建了像这样,
-(IBAction)segment1:(id)sender
{
UISegmentedControl *segmentedControl = (UISegmentedControl *) sender;
NSInteger selectedSegment1 = segmentedControl.selectedSegmentIndex;
if (selectedSegment1 == 0)
{
view2.hidden = YES;
view1.hidden = NO;
}
else if (selectedSegment1 == 1)
{
view2.hidden = NO;
}
}
-(IBAction)segment2:(id)sender
{
UISegmentedControl *segmentSelected2 = (UISegmentedControl *)sender;
NSUInteger selectedSegment2 = segmentSelected2.selectedSegmentIndex;
{
if (selectedSegment2 == 0)
{
UIStoryboard *recent = self.storyboard;
ViewController2 *recentVC = [recent instantiateViewControllerWithIdentifier:@"VC2"];
[self presentViewController:recentVC animated:YES completion:nil];
}
else if (selectedSegment2 == 1)
{
UIStoryboard *story = self.storyboard;
ViewController3 *VC = [story instantiateViewControllerWithIdentifier:@"VC3"];
[self presentViewController:VC animated:YES completion:nil];
}
}
。我的问题是当用户点击segment2 = 0进入另一个视图时。
这是我的一些代码。
SELECT id, COUNT(*)
FROM shop
WHERE convert(datetime, receipt_date, 101) BETWEEN DATEADD(year, -1, GETDATE()) AND GETDATE()
GROUP BY id, receipt_number
}