An image forming apparatus, comprising:
- an image forming unit forming images on sheets;
- a sheet feeder feeding the sheets to the image forming unit, the sheet feeder including:
- a housing;
- a sheet cassette having a storage space for storing sheets and insertable into the housing in a first direction;
- a feed roller feeding the sheets from the sheet cassette when the sheet cassette is set to a feeding position;
- a remaining amount detecting member including a rotatable contact piece and a rotating portion rotating the contact piece upward and downward with respect to the storage space, and detecting a remaining amount of the sheets in the sheet cassette according to a position of the contact piece, the contact piece extending in a second direction opposite to the first direction, including a supporting point at an upstream side in the second direction and coming into contact with an uppermost one of the sheets in the sheet cassette at a downstream side, the rotating portion including a rotary shaft and an extending piece extending near the rotary shaft;
- and
- a switching member switching the position of the contact piece between a contact position where the contact piece enters the storage space to come into contact with the uppermost sheet and a retracted position where the contact piece is retracted from the storage space, the switching member including a pressing portion capable of pressing the rotating portion and a touching piece capable of coming into contact with the wall portion of the sheet cassette, the pressing portion including a receiving portion having a shape capable of rotatably receiving the rotary shaft and a pressing projection formed in the receiving portion and having a shape capable of coming into contact with the extending piece, the touching piece being connected to the receiving portion and configured to rotate upward and downward;
- wherein the touching piece of the switching member comes into contact with the wall portion and is rotated upward when the sheet cassette is inserted into the housing in the first direction and set to the feeding position, thereby rotating the receiving portion, separating the pressing projection from the extending piece and permitting the contact piece to rotate downward to the contact position, while the touching piece separates from the wall portion and rotates downward when the sheet cassette is separated from the feeding position and withdrawn from the housing, thereby rotating the receiving portion, bringing the pressing projection into contact with the extending piece and rotating the contact piece upward to the retracted position.